8. Modbus protocol
8. 2. Modes
bRTU mode
The Modbus RTU frame contains no message header byte, nor end of message bytes. It is defined as follows:
Slave address
Function code
Data
CRC16
The data is transmitted in binary code. CRC16: Cyclic redundancy check parameter.
The end of the frame is detected on a silence greater than or equal to 3.5 characters. The format used for the frames in the rest of this document is RTU mode.
bASCII mode
The structure of the Modbus ASCII frame is as follows:
Header | Slave | Function |
| Data |
":" | address | code |
|
|
|
|
|
|
|
LRC
HiLo
End
"CR" "LF"
Header: By default, ":" = 16#3A. Two other characters are possible: "CR" = 16#0D and "LF" = 16#0A.
LRC: The
Example: Write a value of 10 to logic address word 9001 (16#2329) on slave 2
Identical request and response:
In hexadecimal format
3A
30 32
30 36
32 33 32 39
30 30 30 41
41 32
0D
0A
In ASCII format
: | 0 | 2 |
0 6
2 | 3 | 2 | 9 |
0 0 0 A
A 2
CR
LF
26