57
CRC16
Calculates with all characters (excluding headers) by following method.
CRC characters are used for the calculation. (Initial value: [0x00])
1. The character is logically shifted 8 bits to the left
2. Calculates the total value in 1. and the CRC character by the exclusive
OR.The calculated value is assigned to the CRC character.
3. Repeats the following calculation for 8 times.
3-1. Calculates the CRC character and [0x8000] by the logical
conjunction.
3-2. The CRC character is logically shifted 1 bit to the left .
3-3. When the result of (3) is other than 0, calculates the CRC
character and [0x1021] by the exclusive OR and assigns the
calculated value to the CRC character.
3-4. Calculates the CRC character and the logical AND of [0xFFFF].
The calculated value is assigned to the CRC character.
4. Calculates
the values of “1.” – “3.” with all the characters excluding
headers.
5. The calculated CRC character is devided into upper 8 bits and lower 8
bits.
(Output Example)
The output sample contains binary data. Therefore it is written in hexadecimal.
The data used in this output example is as follows.
(Hexadecimal notation is shown in parentheses.)
Data : 123 ( [0x30][0x31][0x32] )
Header : SX ( [0x02] )
Terminator : CR ( [0x0D] )
1. LRC(BCC)
[0x02][0x31][0x32][0x33][0x0D]
[0x3D]
2. SUM128
[0x02][0x31][0x32][0x33][0x0D]
[0xA3]
3.CRC16
[0x02][0x31][0x32][0x33][0x0D]
[0x70][0xF3]