App. - 52 App. - 52
APPENDIXES
(4) Procedure for calculating 16-bit CRC (for MODBUS)
This is a check system that is used only when data are sent/received in the RTU
mode of the MODBUS protocol. The data length of CRC is fixed to 2 bytes (16
bits), and the CRC is calculated every 1 byte (8 bits) from the start of the
calculating range according to the following procedure.
1) Load a 16-bit register whose bits are all '1'.
2) Exclusive OR (XOR) the first 1 byte (8 bits) of the calculating range
with 8 bits in above 1).
3) Shift the result of 2) one bit right.
4) If the latest significant bit in above 2) is '1', exclusive OR (XOR) the
result of 3) with the generator polynomial (A001
H
). If the last bit is '0',
shift the result of 2) one bit right (operation described in 3)) without the
exclusive OR (XOR) operation.
5) Repeat steps 3) and 4) until 8 shifts have been performed.
6) Exclusive OR (XOR) the result of 5) with the next 1 byte (8 bits).
7) Repeat step 2) through 6) until all bytes have been processed.
The final result is CRC value.
8) When the CRC value is placed in a packet, the lower 8 bits are set first,
and then the upper 8 bits are set.
For the specific example of calculation, refer to the table on the next page.
Summary of Contents for MELSEC LJ71C24
Page 1: ......
Page 2: ......
Page 18: ...A 16 A 16 INDEX REVISIONS WARRANTY...
Page 22: ...A 20 A 20 2 LJ71C24 R2 LJ71C24 R2 Before Using the Product...
Page 23: ...A 21 A 21 MEMO...
Page 38: ...4 2 4 2 4 PROCEDURES PRIOR TO OPERATION MEMO 4...
Page 105: ...7 30 7 30 7 SETTINGS FOR THE C24 MEMO...
Page 425: ......
Page 426: ......
Page 427: ......