How this works. A CRC treats the message as a long binary polynomial and returns
the remainder after dividing by a generator polynomial. The parameters matter as much as the
polynomial:
init seeds the register,
refin/
refout reflect
the bit order going in and coming out, and
xorout inverts the result. Two
implementations with the same polynomial and different reflection settings produce completely
different checksums — which is the usual reason a CRC "doesn't match". Modbus and CCITT both use
well-known parameter sets and are not interchangeable.
Byte order on the wire is a separate
trap: Modbus transmits the CRC low byte first, so the frame ends with the bytes reversed
from how the checksum is written.