Mitsubishi Melsec-L Series User Manual page 381

Communication module
Hide thumbs Also See for Melsec-L Series:
Table of Contents

Advertisement

App. - 52
(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
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.
APPENDIXES
). If the last bit is '0',
H
App. - 52

Advertisement

Table of Contents
loading

This manual is also suitable for:

Lj71c24Lj71c24-r2

Table of Contents