hello, i would really appreciate some help with the problem i'm facing.
I'm trying to read in modbus registers from a energymeter.
i have succesfully read registers from a Schneider IEM 3150 meter, but now i have to read from the Eastron sdm630 meter and i receive errorcode 224, which means invalid response slave ID.
I am using the MAX485 module with DE and RE connected to pin 2.
Pin 9 and 10 are respectively connected to RO and DI.
This is my code now.
#include <ModbusMaster.h>
#include <SoftwareSerial.h>
#include <SD.h>
#define TxEnable 2
// instantiate ModbusMaster object
ModbusMaster node;
SoftwareSerial mySerial(9,10);
File myFile;
void preTransmission()
{
digitalWrite(TxEnable, 1);
}
void postTransmission()
{
digitalWrite(TxEnable, 0);
}
void setup()
{
// use Serial (port 0); initialize Modbus communication baud rate
Serial.begin(9600);
mySerial.begin(9600);
node.begin(1, mySerial);
pinMode(TxEnable,OUTPUT);
node.preTransmission(preTransmission);
node.postTransmission(postTransmission);
}
void loop()
{
uint8_t result;
uint8_t Test;
Test = node.available();
result = node.readInputRegisters(0x0000 ,2);
Serial.println(result);
delay(2500);
}
Thank you in advance.