Hi Everyone, I am trying to read holding register of a electromagnetic flowmeter Proline Promag P 300 via RS485 using Modbus RTU but unable to do. I am new to Arduino and getting so much confused by different library e.g. ModbusMaster.h and SimpleModbusMaster.h etc.
I am using RS-485 toTTL to module and also have 1 arduino mega.
This is register addres:
For more information use this link about Promag 300:
My code:
#include <ModbusMaster.h>
#include <SoftwareSerial.h>
SoftwareSerial mySerial(5, 3); // RX, TX
ModbusMaster node;
void setup() {
Serial.begin(9600);
mySerial.begin(9600);
node.begin(1, mySerial);
}
void loop() {
uint8_t result;
uint16_t data;
result = node.readHoldingRegisters(5050, 1);
if (result == node.ku8MBSuccess) {
data = node.getResponseBuffer(0);
Serial.print("Register 5051 value: ");
Serial.println(data);
} else {
Serial.println("Error reading from register 5051.");
}
delay(1000);
}
and module what i use:
Please help me out and thanks in advance.
And please let me know if any other information I need to provide.



