nettogrisen
Lifetime Supporting Member
I'm trying to understand how the modbus RTU protocol works.
From what I understand after reading the Modbus over serial line specification and implementation guide:
Each 8-bit byte in a message contains two 4-bit hexadecimal characters.
- So good so far
It then reads:
The format ( 11 bits ) for each bye in RTU mode is:
Coding system:
8-bit binary
Bits per byte:
1 start bit
8 data bits, least significant bit sent first
1 bit for parity completion
1 stop bit
- Does every 8-bit byte, including the slave address, function code and CRC need start, stop and parity bits, or is this only for the data part of the frame?
I'm really not getting this part... Do I need to transmit 11 bits per byte?
- Am I correct that the startbit is always low, and the stopbit is always high, or are they calculated somehow?
Could a message look like this?:
These are the questions that I could come up with right now.
Am I way off course? Any help would be appreciated.
From what I understand after reading the Modbus over serial line specification and implementation guide:
Each 8-bit byte in a message contains two 4-bit hexadecimal characters.
- So good so far
It then reads:
The format ( 11 bits ) for each bye in RTU mode is:
Coding system:
8-bit binary
Bits per byte:
1 start bit
8 data bits, least significant bit sent first
1 bit for parity completion
1 stop bit
- Does every 8-bit byte, including the slave address, function code and CRC need start, stop and parity bits, or is this only for the data part of the frame?
I'm really not getting this part... Do I need to transmit 11 bits per byte?
- Am I correct that the startbit is always low, and the stopbit is always high, or are they calculated somehow?
Could a message look like this?:
<3.5 char wait>
0x0001 (Slave address 1)
0x0001 (Function code 1, read coils)
0 (Low bit for start bit)
0x0000 (Starting address 0)
1 (Parity bit)
1 (High bit for stop bit)
0 (Low bit for start bit)
0x0005 (Read 5 coils)
1 (Parity bit)
1 (High bit for stop bit)
0x0000 (CRC low byte)
0x0000 (CRC high byte)
<3.5 char wait>
These are the questions that I could come up with right now.
Am I way off course? Any help would be appreciated.