I need to be able to calculate a CRC in order to communicate with a machine. I'm pretty new to calculating CRC's so I'm sorry if this exact question has already been answered as I'm not sure what I am looking for. Anyway, I need to compute a CCIT 16-bit CRC in Python. My message is a binary stream that looks like:
b'G18M1314D4417,2511165'
The message also begins with a STX and ends with a ETX character. I tried using this Python module:
import crc16
print(crc16.crc16xmodem(b'G18M1314D4417,2511165'))
Which returned:
61154
When the correct CRC was:
A855
What am I missing?
Edit: I'm using Python 3.3. I got the 'correct' CRC from a message sent from the machine. I'm not sure whether STX/ETX characters should be included as I have never worked with CRC's before.
correctCRC really is for that message - something doesn't add up but I'm afraid it's not possible to see where with this info. - Tom Dalton