Basic Stamp 633 CRC example

cbell

New member
Does anyone have an example of calculating the CRC for a 633 with a basic stamp. I have gotten this to work in C#, but the basic stamp is a whole other beast and I thought if someone had accomplished this it would prevent me from reinventing the wheel.
Looking for additional LCD resources? Check out our LCD blog for the latest developments in LCD technology.
 

Joe

New member
Thanks for everybody's help, I found the answer to CRC-16 code for the BS2 and PIC's. Here it is... Test it against this sites calculator CRC Calculator
Code:
CRC VAR Word 
Calc VAR Word 
aByte VAR Byte 
Counter VAR Nib 

POLYNOMIAL CON $8408

Main: 
CRC = $0000 
aByte = "1": GOSUB Calc_Crc 
aByte = "2": GOSUB Calc_Crc 
aByte = "3": GOSUB Calc_Crc 
aByte = "4": GOSUB Calc_Crc 
aByte = "5": GOSUB Calc_Crc 
aByte = "6": GOSUB Calc_Crc 
aByte = "7": GOSUB Calc_Crc 
aByte = "8": GOSUB Calc_Crc 
aByte = "9": GOSUB Calc_Crc 
DEBUG HEX crc 
END 

Calc_Crc: 
FOR Counter = 0 TO 7 
Calc = aByte ^ CRC & 1 
IF Calc = 0 THEN CRC_Add 
Calc = POLYNOMIAL 
CRC_Add: 
CRC = CRC / 2 ^ Calc 
aByte = aByte / 2 
NEXT 
RETURN
 
Top