Modbus RTU rs485 and PM5300 [SOLVED]

Hi everyone, I working to get data from Power Meter PM5300 of Schneider, with Modbus RTU protocol and physical layer rs485.

Hardware: MAXRS485, Arduino Mega;
Software: the library used is ModbusMaster of github;

I was working with TUF-2000M and i had achivieve some datas, and from the code used , i think that is only necessary, change the holding registers of code;
The code used:

#include<ModbusMaster.h> //include Modbus library
//#include<SoftwareSerial.h>
#define MAX485_DE 22 //high to enable
#define MAX485_RE_NEG 21 //low to enable
ModbusMaster node;
void preTransmission()
{
digitalWrite (MAX485_RE_NEG, 1);
digitalWrite (MAX485_DE, 1);
}
void postTransmission()
{
digitalWrite (MAX485_RE_NEG, 0);
digitalWrite (MAX485_DE, 0);
}
void setup()
{
pinMode(MAX485_RE_NEG, OUTPUT);
pinMode(MAX485_DE, OUTPUT);
digitalWrite(MAX485_RE_NEG, 0);
digitalWrite(MAX485_DE, 0);
Serial.begin(9600);
Serial1.begin(9600,SERIAL_8N2);
node.begin(1, Serial1);
node.preTransmission(preTransmission);
node.postTransmission(postTransmission);
}
void loop()
{
union
{
uint32_t i;
float f;
}u;
uint8_t result = node.readHoldingRegisters(0x24, 2);
Serial.println("Result : " + String(result,HEX));
if (result == node.ku8MBSuccess)
{
u.i=(((unsigned long)node.getResponseBuffer(0x01)<<16) | (node.getResponseBuffer(0x00)));
}
Serial.println("Reading is "+String(u.f,5));
delay(2000);
}

When change the number of register for read some data, the serial returns some values of errors, where is possible read on documentation that:

0x01 : Modbus protocol illegal function exception. when i user readInputRegisters
0x02,0x03: Modbus protocol illegal data address exception,Modbus protocol illegal data value exception, when i used the register the same way as it is of register list.

I would like that somebody worked PM5300 tell me about which are the holding registers, or if anybody can help me understant which are the registers of function 0x03 and if the data read are passed with format of lecture different of TUF-2000M

The registers list are attached, i think that is so confused, the modbus register list
The registers list of PM5300 is PowerLogic PM5000 Series (PM5100, PM5300, PM5500) Modbus Register List | Schneider Electric Global

Manual.pdf (890 KB)

I would like that somebody worked PM5300 tell me about which are the holding registers, or if anybody can help me understant which are the registers of function 0x03 and if the data read are passed with format of lecture different of TUF-2000M

I don't understand why you attach a manual for a completely different device.

Please edit your post and insert code tags!

According to the register list, your device doesn't have a special functionality in register 0x24 (= 36). It should be empty as the string "Power Meter" is in registers 30-34.

The registers list are attached, i think that is so confused, the modbus register list

No, it isn't. That's a completely different device.

Serial1.begin(9600,SERIAL_8N2);

If your device is still in it's default config, the serial config should be 19200, SERIAL_8E1, according to the (PM5300-) manual.

I confess that I put the wrong registers when I attached, looking better on the Internet found a very effective solution, the meter data is received inversely to the TUF-2000M, so the conversion to float was not working, I will leave the codes in attachment and hope it helps others.

here the attached files, i hope that helps

PM5300.ino (2.67 KB)

REG_PM5300.h (241 Bytes)