236
Modbus-ASCII data structure
ASCII mode:
For Modbus ASCII
(
American Standard Code for Information Interchange
)
mode in serial
links, every 8-bit byte is sent as two ASCII characters. When communication links and
devices do not fit RTU mode timing monitor, we usually use the ASCII mode.
Note
:
One byte needs two characters, so ASCII mode has lower inefficiency than RTU
mode.
E.g.: Byte 0X5B will be encoded as two characters: 0x35 and 0x42
(
ASCII code 0x35
="5"
,
0x42 ="B"
)
.
ASCII mode frame check domain
:
Longitudinal Redundancy Checking (LRC)
ASCII mode frame description:
Start mark
Modbus no. Function code data
LRC
End mark
1 character
2 characters 2 characters
0~252*2
characters
2 characters
2 characters
0x3A
0x0D 0x0A
Format
:
STX (3AH)
Start mark=3AH
Address code high bit
Communication position
(
no
):
Consist of 2 ASCII codes
Address code low bit
Function code high bit
Function code
(
command
):
Consist of 2 ASCII codes
Function code low bit
Instruction start ID
Command start bit
:
Consist of 4 ASCII codes
Instruction start ID
Instruction start ID
Instruction start ID
Data length
Length from start to end
:
Consist of 4 ASCII codes
Data length
Data length
Data length
LRC check high bit
LRC check code
:
Consist of 2 ASCII codes
LRC check low bit
END high bit
End mark
:
END Hi=CR
(
0DH
),
END Lo=CR
(
0AH
)
END low bit
2. Communication address
:
00H
:
All Xinje XC series PLC broadcast—— slave stations do not response.
01H
:
Communicate with address 01H PLC.
0FH
:
Communicate with address 15H PLC.
10H
:
Communicate with address 16H PLC.
And so on, up to 254
(
FEH
)
.
3. Function and DATA
:
Function
code
Function
Corresponding modbus
01H
Read coil
COLR
02H
Read input coil
INRR