N
Nexting
Guest
Hi To All:
im Trying to build a vending unit that uses serial data to get general information counters,status,serial an anotherInfo. I´m trying to implement a crc routine based in this Picbasic crc8 routine.
But this only works when do you have the hex string value previously defined on the code this is not my case,for example when i need interrogate the serial id i send the value in hex ($23,$47) the right reply for the unit is reply ($23,$47) serial number($01,$08,$24,$36,$49) and crc8(?)this data not always the same and could change in new units. my question is this the most simple way to build a crc? could be implemented when the data is out over Hserout? or perhaps is more complex. Sorry for extend this explanation but is not to clear for me. Really appreciatte any advice about this issue.
Best Regards
Nexting
im Trying to build a vending unit that uses serial data to get general information counters,status,serial an anotherInfo. I´m trying to implement a crc routine based in this Picbasic crc8 routine.
Code:
CRC8:
FOR CRC_IDX = 0 to 7
IF (CRC.7 ^ CRC_IN.7) THEN
CRC = (CRC << 1) ^ CRC_Poly 'equals($31)
ELSE
CRC = CRC << 1
eNDIF
CRC_IN = CRC_IN << 1
NEXT CRC_IDX
RETURN
But this only works when do you have the hex string value previously defined on the code this is not my case,for example when i need interrogate the serial id i send the value in hex ($23,$47) the right reply for the unit is reply ($23,$47) serial number($01,$08,$24,$36,$49) and crc8(?)this data not always the same and could change in new units. my question is this the most simple way to build a crc? could be implemented when the data is out over Hserout? or perhaps is more complex. Sorry for extend this explanation but is not to clear for me. Really appreciatte any advice about this issue.
Best Regards
Nexting