Pages: [1]   Go Down
Author Topic: Modbus 1/7/N/1  (Read 476 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'm trying to communicate with a MODBUS slave device.  The data sheet shows the protocol to be:

  Modbus ASCII
  RS-485
  9600 bps baud rate
  1 start bit, 7 data bits, no parity, 2 stop bits
  LRC (Longitudinal Redundancy Check)

Presumably I will need a RS485 breakout to convert the Arduino's UART serial to RS-485?

What about the frame format?  I think the Arduino is set to 8N1, so I need to somehow change that to 1 start bit, 7N1.

How do I go about changing this?  Can it even be done?
Logged

Austin, TX
Offline Offline
God Member
*****
Karma: 12
Posts: 524
carpe diem
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You can simulate 7N2 with 8N1 by always setting the most significant bit to 1 for each byte sent.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks Louis, how do I set the MSB to 0?  Is that really all I need to do?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

For 25 LEDs you only need 4 shift registers.
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Where did 25 LEDs get mentioned? Or shift registers?
Logged

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 126
Posts: 8472
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
For 25 LEDs you only need 4 shift registers.
That was another thread smiley

Quote
how do I set the MSB to 0?
He said "setting the most significant bit to 1" BTW.

For every byte you send OR it with 0x80. Eg

Code:
send_modbus_byte (my_byte | 0x80);

Quote
Is that really all I need to do?
Should be.

______
Rob
Logged

Rob Gray aka the GRAYnomad www.robgray.com

United States
Offline Offline
Newbie
*
Karma: 0
Posts: 41
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Did you find a library you liked for modbus communication yet?
Logged

Pages: [1]   Go Up
Jump to: