112
start
‘:’
Address
‘0’
‘1’
cmd
‘0’
‘3’
数据起始地址
Data source
address
高位
high
bit
‘ 0 ’
‘ 0’
低位
low
bit
‘1’
‘ 3 ’
读寄存器个数
Read the register number
‘ 0 ’
‘ 0 ’
‘ 0 ’
‘ 2’
LRC
‘E’
‘7’
END1(CR)
0DH
END0(LF)
0AH
从
Address
的数据加至最后一个数据:
From the Address data add to the last data:
01 H +03H+00H+13H+00H+02H=19H,
因
19H
的补码为
E7H
,所以
LRC
为‘
E
’,‘
7
’
01
H + 3 H + 00 00 H + 13 H + H + 02 H = 19 H, for 19 H complement E7H, so LRC England as the 'E', '7'
2. CRC
校
验
CRC check
RTU
模式采用
CRC
(
Cyclical Redundancy Check
)校验码。循环冗余校验
(CRC)
域为两个字节,包含一
个二进制
16
位值。附加在报文后面的
CRC
的值由发送设备计算。接收设备在接收报文时重新计算
CRC
的值,并将计算结果于实际接收到的
CRC
值相比较。如果两个值不相等,则为错误。
RTU mode adopts CRC
(Cyclical Redundancy Check) Check code. Cyclic redundancy check (CRC) domain into two bytes, containing
a binary 16-bit value. Attached to the message behind the CRC value calculated by the transmitting device.
When receiving device on the receiving message to recalculate the CRC value, and the calculated results
compared to actually receives the CRC value. If the two values are not equal, is wrong.
CRC
的计算
,
开始对一个
16
位寄存器预装全
1.
然后将报文中的连续的
8
位子节对其进行后续的计算。
只有字符中的
8
个数据位参与生成
CRC
的运算,
起始位,
停止位和校验位不参与
CRC
计算。
CRC calculation,
to a 16-bit registers with full 1. Then put the message in the continuous section 8 of the seats on the
subsequent calculations. Only the characters of the eight data bits participate in the operation of generating
CRC, start bit, stop bits and parity bit CRC calculation will not be involved.
生成
CRC
的过程为
:
To generate CRC process as follows: