Go Down

Topic: Modbus RTU questions... (Read 647 times) previous topic - next topic

Weller

Hi,

I have a metering device that has a RS485 communication interface using the MODBUS protocol.  The datasheet for the meter is brief to say the least.  Its Modbus RTU mode protocol, 9600 baud rate, 8 data bits, no parity, one stop bit, with CRC verify.

It gives an example frame as:

Quote

Reading Data?
The code of PC?
Function code                   Data
00      03      00     00      00      03       CRCL      CRCH
Device Address      Address Register                    16 digits CRC verify

The code of meter?
       Function code         1  2     3  4   5  6
00        03      06      00 12    00 34   00 56         CRCL      CRCH
Device Address       Data  ?value of reading 123456??hex?   16 digits CRC verify


My question is how do I fire the 'code of PC' out of the Arduino and then read back the response? 

CrossRoads

Start with a RS485 board so you can communicate
https://www.sparkfun.com/products/10124

Then just Serial.print the data to go out, and Serial.read it back in.

I don't know what algorithm you would use for CRCL & CRCH, you haven't provided enough data. Maybe its just an addition of all the preveding data, sent over as a low byte & a high byte of an int.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

ellepiu

http://www.biemmeitalia.net/blog/en

Go Up