Reading register using Modbus master/arduino uno

Thread Starter

Vindhyachal Takniki

Joined Nov 3, 2014
594
1. I ma using this modbus library to read (EM)6433, meter from scheider.
Lib: https://github.com/4-20ma/ModbusMaster
doc: http://4-20ma.io/ModbusMaster/

2. (EM)6433 documentation is here: http://tinyurl.com/z7696ys

3. Page 3 of above doc says that protocol is Modbus RTU, data:8 bits, baud: 9600(default) , parity:even, device address:1, stop bit:1

In uno code, default seting is 9600 & parity zero. Is below setting ok in code:

ModbusMaster node;
Serial.begin(9600, SERIAL_8E1);
node.begin(1, Serial);


4. (EM)6433 doc on page 7 shows, read register "Average current", with address "3913" & reurn type is float 4 bytes in little endian.

However this library has function "readHoldingRegisters" to read holding register. But this function reads only 16 bit registers.

So should I use the function as:
result = node.readHoldingRegisters(3913, 2);
if (result == node.ku8MBSuccess)
{
for (j = 0; j < 2; j++)
{
data[j] = node.getResponseBuffer(j);
}
}

parameter 2, shows that 2 16 bit values are read.
How to convert it back to float?
 

Thread Starter

Vindhyachal Takniki

Joined Nov 3, 2014
594
1. I have interfaced EM-6433 using arduino over Rs485. Rs485 IC used is SN75HVD08.

2. EM-6433 settings are slave id:1 & baud:19200, even parity & 1 stop
Confirmed it aftr turing on meter & go to its settings table.

3. Case 1: If I permanently pull down N_RE pin & pull up DE pin of SN75HVD08, then when I used the attached code I always receive 0xE2 in return from device ie ku8MBResponseTimedOut. In code ignore the code which ouput high & low the RE & DE pin. This is used in case 2. In this case, this is commented out.

4. Case2: Since this SN75HVD08 is half duplex so I connected RE & DE pins to arduino as in attached circuit. Also I have modified ModbusMaster.cpp file in line 728 & 729, where I added code to disable Tx & enable rx from IC. When I use this code I receive error 0x02 in result, which is ku8MBIllegalDataAddress.
What am I doing wrong here. I also interchanged A & B pins to slave device EM-6433 + & -. But no correct result obtained.

5.All ckt diagram and code is here: https://drive.google.com/open?id=0B-jbeBk3wfkWaWo1ek5ISUxoTzA
 
have you finish this? Can you share me? <email address snipped> Thanks so much.

Moderator's note: please do not post email addresses. It attracts spammers to you and us, too.
 
Last edited by a moderator:
Top