Does any one have guide routine in PICBasic to calculate CRC16bit MODBUS ?
Thank,
Grich
Does any one have guide routine in PICBasic to calculate CRC16bit MODBUS ?
Thank,
Grich
A quick forum search found this:
http://www.picbasic.co.uk/forum/showthread.php?t=7646
"I think fish is nice, but then I think that rain is wet, so who am I to judge?" - Douglas Adams
Thanks, and I found list below/
Is this routine right ?
Calcul_CRC16:
CRC16=$FFFF
For i=0 to (DataAmount -3)
CRC16=CRC16^DATACRC[i]
For j=1 to 8
IF CRC16.Bit0=1 Then
CRC16=$A001^(CRC16>>1)
Else
CRC16=CRC16>>1
EndIF
Next j
Next i
Return
Bookmarks