
11
INZ-TN5A0506-E
5.5 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 calculates the CRC of the received message and ignores the message if this value is not the same as
the received CRC code.
The following shows the calculation procedure for CRC-16.
(a)
Store FFFFH into 16 bits register (CRC register)
(b)
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.
(c)
Shift the CRC register contents 1 bit to the right. Store 0 at MSB.
(d)
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.
(e)
Repeat the steps (c) and (d) 8 times (shift by 8 bits).
(f)
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.
(g)
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.
(h)
As error check code of the transmit message, store this CRC value in the order of lower 8 bits and upper
8 bits.
Fig. 5-3 Shows the flow of the CRC-16 calculation system.
01
H
06
H
00
H
05
H
03
H
E8
H
99
H
75
H
Calculate the date between these
numbers in order, figure out CRC.
In this case, CRC=75 99
H
Attach the error check code to
message upon interchanging the
upper CRC and lower orders.
Transmit message (ex.)
Содержание ZKM
Страница 37: ......