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)