Modbus 1/7/N/1

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?

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.

Where did 25 LEDs get mentioned? Or shift registers?

For 25 LEDs you only need 4 shift registers.

That was another thread :slight_smile:

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

send_modbus_byte (my_byte | 0x80);

Is that really all I need to do?

Should be.


Rob

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