Pages: [1]   Go Down
Author Topic: Modbus RTU questions...  (Read 581 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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? 
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 538
Posts: 27114
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Newbie
*
Karma: 0
Posts: 30
I am passionate about electronics, industrial and home automation. Love DIY stuff
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi
Take a look at http://www.biemmeitalia.net/blog/android-touchscreen-communicates-with-arduino-using-modbus-rs485
I hope it helps you

elle
Logged


Pages: [1]   Go Up
Jump to: