Expand description
Modbus CRC-16 and LRC checksum functions.
- CRC-16/MODBUS: Used by Modbus RTU frames. Polynomial 0xA001 (reflected), init 0xFFFF, no final XOR.
- LRC: Longitudinal Redundancy Check used by Modbus ASCII frames. Two’s complement of the sum of all bytes (mod 256).
Functions§
- modbus_
crc16 - Compute the Modbus CRC-16 checksum.
- modbus_
lrc - Compute the Modbus LRC (Longitudinal Redundancy Check).
- verify_
crc16 - Verify the CRC-16 of a complete Modbus RTU frame (data + 2-byte CRC).
- verify_
lrc - Verify the LRC of a data slice where the last byte is the LRC.