I’m trying to talk to a system over RS485 (I have the necessary hardware) that uses this protocol:
Each word consists of 11 bits. They are:
• Start bit space
• 8 data bits least significant bit transmitted first
• Parity Odd
• Stop bit Mark
Can this be done with an Arduino and RS485? No library I tried had SERIAL_8O1 option and I have no clue on how to send ‘start bit space’.
Anyone can help me out?
If there’s an expert here from Holland, I’d like to meet up and tackle some issues (paid).
With those older standards like RS485 and RS232, they didn't specify HIGH and LOW like we use today. They specified the two states for the line as "mark" and "space". You could think of that as 1 and 0 or HIGH and LOW although the "mark" state is the resting state of the line when there's no data being transmitted and that can (in the case of RS232) be a negative voltage.
The start bit must be different from the resting state, otherwise you wouldn't know that the state had changed. The stop bit must be the same, so that you can see the following start bit as a different state. So start is a space and stop is a mark.
SERIAL_8O1 should be correct for that specification. If it doesn't work, try swapping the A and B wires first, then swap Tx and Rx.
There is nothing weird about that data string. Assuming async communications, you always need a start bit. The arduino can handle 5 to 9 data bits ( 9 for address mode). Then there is odd, even or no parity, followed by 1 or 2 stop bits.
What you have is a very common comm string. A lot don’t use parity.
Look it up in the data sheet for the register settings.
To talk to your board, you are using a 10 bit protocol, no parity.
When parity is set, it is generated and handled by the UART.
Maybe this article on TIA-485 (formerly RS-485) may provide you with some insight on connecting Arduino with this electrical specification: https://www.gammon.com.au/forum/?id=11428
Remember, TIA-485 or RS-232 is NOT a protocol as many people tend to think.
TIA-485 and RS-232 are simply an electrical specifications where you can then implement a data protocol on, such as Modbus for example.
The Arduino code environment allows you to set up asynchronous serial ports with all standard parameters in terms of baud, start/stop and data bits and parity. You do not need to concern yourself with code for this, just set the port up with the correct parameters.
Paul - VK7KPA