How Can I read address 30002 with 2 register? I need to read volume flow of water. Using modscan32 and a usb adapter for rs485 I can read the correct value, but with arduino and this library the read value is different. According to the manual address 30002 is read as inputRegister.
I’m using the mega arduino and the RS-485 TTL MODBUS converter
I am using the IFC050 flow sensor (modbus manual link below) look at page 12:
What’s wrong with the code below?
//Code used in the project.
#include <ModbusMaster.h>
#define MAX485_DE 3
#define MAX485_RE_NEG 2
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(19200);
node.begin(1, Serial1);
node.preTransmission(preTransmission);
node.postTransmission(postTransmission);
}
void loop(){
uint8_t result;
uint16_t data[6];
result = node.readInputRegisters(30002, 2);