Skip to content

Message Body Checksum

Joe Moran edited this page Mar 20, 2021 · 6 revisions

The two bytes at the end of a message are CRC16 generated from:

def crc16(msg):
    acc = 0x00
    for x in msg:
        acc = (acc >> 8) ^ crc_table16[(acc ^ ord(x)) & 0xff]
    return acc

ID2, B9, BLEN and BODY are all included in the CRC16 the checksum.

The B9 byte includes a 4-bit packet sequence #, the top two bits of the 10-bit message length and an alarm bit.

Clone this wiki locally