Calculating Error Check Code (Crc-16) - Fuji Electric PXG-9 Communication Instruction Manual

Digtal controller micro controller x communication function (rs-485 modbus)
Hide thumbs Also See for PXG-9:
Table of Contents

Advertisement

Calculating Error Check Code (CRC-16)

CRC-16 is a 2-byte (16-bit) error check code. The calculation range extends from the start of the message (station number) to the
end of the data part.
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.
CRC-16 is calculated as follows.
Chapter
5
Exclusive-or (XOR) runs on each character of J (one byte) for CR
and the specified message, and sets that result to CR.
After CR has been adjusted one bit to the right, A001
run and set that result to CR.
Start
Set CR to FFFF
Set J = 1
Set K = 1
Is the right-hand
bit for CR 1?
Add 1 to K
NO
Has calculation
finished 8 times ?
J > 8
Add 1 to J
Has every character
NO
been calculated ?
J > Number of characters
Complete
* Description of Variables
CR : CRC error check data (2 byte)
(hexadecimal)
H
J
K
NO
YES
and XOR
H
YES
YES
– 24 –
: Command message calculation
character digit
: No. of times to check CR calculation
Adjust CR one bit
to the right.
(Calculations occur in the order
command message station number,
function code, and data.)
The CR calculation result is added
onto the end of the command
message in LOW or HIGH order.

Hide quick links:

Advertisement

Chapters

Table of Contents
loading

This manual is also suitable for:

Pxg-5Pxg-4

Table of Contents