EasyManua.ls Logo

Fuji Electric PXG-9 - Calculating Error Check Code (CRC-16)

Fuji Electric PXG-9
84 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
– 24 –
5
Chapter
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.
YES
YES
NO
NO
YES
* Description of Variables
CR : CRC error check data (2 byte)
J:Command message calculation
character digit
K:No. of times to check CR calculation
Start
Set J = 1
Set K = 1
Add 1 to K
Complete
Add 1 to J
Set CR to FFFF
H (hexadecimal)
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
H and XOR
run and set that result to CR.
Is the right-hand
bit for CR 1?
NO
Adjust CR one bit
to the right.
Has calculation
finished 8 times ?
J > 8
Has every character
been calculated ?
J > Number of characters
(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.

Related product manuals