Skip to main content

Module crc

Module crc 

Source
Expand description

CRC-16/X-25, the checksum SML uses for both the transport frame and each message, and CRC-16/KERMIT, the checksum some meters use instead.

CRC-16/X-25: polynomial 0x1021 (reflected 0x8408), initial value 0xFFFF, input and output reflected, final XOR 0xFFFF. Check value over "123456789": 0x906E.

Byte order on the wire. The CRC is transmitted low byte first, as in HDLC, both in the transport end sequence and in a message’s Unsigned16 CRC field. Every CRC-valid frame in the public real-meter corpus agrees.

CRC-16/KERMIT uses the same reflected polynomial with initial value 0 and no final XOR (check value 0x2189). Some Holley DTZ541 units compute it instead of X-25. CrcCheck::Lenient accepts it; CrcCheck::Strict does not.

Structs§

Kermit
An incremental CRC-16/KERMIT.
X25
An incremental CRC-16/X-25.

Enums§

CrcCheck
How strictly a CRC is checked.

Functions§

kermit
The CRC-16/KERMIT of bytes.
x25
The CRC-16/X-25 of bytes.