<3. MODBUS PROTOCOL>
3-4
IM 11G02Q02-01EN 2nd Edition : Sep. 04, 2020-00
3.4
Calculation of error check code (CRC-16)
CRC-16 is the 2-byte (16-bits) error check code. From the top of the message (station No.) to the
end of the data field are calculated.
The slave station calculates the CRC of the received message, and does not respond if the
calculated CRC is different from the contents of the received CRC code
The following shows the calculation procedure for CRC-16.
(1) Store FFFF
H
into 16 bit register (CRC register).
(2) Subject the 1st byte (8 bits) of transmit message and CRC register contents to an exclusive
logical summation (XOR), and store the result into the CRC register.
(3) Shift the CRC register contents 1 bit to the right. Store 0 at MSB.
(4) If LSB before shifting is 0, do nothing. If LSB before shifting is 1, subject it and A001H to
XOR, and store the result into the CRC register.
(5) Repeat the steps (c) and (d) 8 times (shift by 8 bits).
(6) Execute steps (b) to (e) for the next byte of the transmit message. Likewise, successively
repeat the steps to each byte of the transmit message.
(7) The CRC code that is retained is the value of CRC register that stands when the processing
has ended for latest byte (latest data except error code) of the transmit message.
(8) As error check code of the transmit message, store this CRC value in the order of lower 8
bits and upper 8 bits
Transmit message (ex.)
01
H
06
H
00
H
05
H
03
H
E8
H
99
H
75
H
Transmit message (ex.)
Successively calculate data
included hereto obtain CRC.
In this case, CRC = 75 99
H
.
Attach the error check code to
message upon interchanging
the upper and lower orders.
Содержание IR202
Страница 7: ...Blank Page ...
Страница 13: ...Blank Page ...
Страница 43: ...Blank Page ...
Страница 45: ...Blank Page ...