Go Down

Topic: Modbus 1/7/N/1 (Read 698 times) previous topic - next topic


Hi, i'm trying to communicate with a MODBUS slave device.  The data sheet shows the protocol to be:

  Modbus ASCII
  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?

Louis Davis

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


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


For 25 LEDs you only need 4 shift registers.

Nick Gammon

Where did 25 LEDs get mentioned? Or shift registers?
Please post technical questions on the forum, not by personal message. Thanks!

More info:


For 25 LEDs you only need 4 shift registers.

That was another thread :)

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: [Select]
send_modbus_byte (my_byte | 0x80);

Is that really all I need to do?

Should be.

Rob Gray aka the GRAYnomad www.robgray.com


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

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131