Oh, and I forgot about this ...
This was my first version.
It was for CRC-16, but I later found that there are many versions of CRC-16.
Even if they have the same "Polynomial".
Might give you some idea's ....
Code:
CRC VAR WORD
CRC_IN VAR BYTE
Idx VAR BYTE
CRC_Len CON 16
CRC_Poly CON $1021 ; x16 + x12 + x5 + 1
;-----CRC-16 -----------------------------------------------------
CRC16:
CRC.HighByte = CRC.HighByte ^ CRC_IN
FOR Idx = 0 to 7
IF CRC.0(CRC_Len-1) THEN
CRC = (CRC << 1) ^ CRC_Poly
ELSE
CRC = CRC << 1
ENDIF
NEXT Idx
RETURN
That's actually faster than my previous measurements.
But the other program can do any polynomial version, which is probably more than you need.
<br>
Bookmarks