Calculation Of Error Check Code (Crc-16) - Fuji Electric ZPA Instruction Manual

Infrared gas analyzer, communication functions modbus
Hide thumbs Also See for ZPA:
Table of Contents

Advertisement

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 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.
(a) Store FFFF
(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.
Transmit message (ex.)
01
06
H
00
H
05
H
03
H
E8
H
99
H
75
H
Fig. 5-3 shows the flow of the CRC-16 calculation system.
12
into 16 bit register (CRC register).
H
Successively calculate data included here
to obtain CRC. In this case, CRC = 75
99
.
H
Attach the error check code to
message upon interchanging the
upper and lower orders.
INZ-TN5A1190-E

Advertisement

Table of Contents
loading

This manual is also suitable for:

ZpbZpg

Table of Contents