Does any one have guide routine in PICBasic to calculate CRC16bit MODBUS ?
Thank,
Grich
Printable View
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
Thanks, and I found list below/
Is this routine right ?
Quote:
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