So either the data arrives twice within the 65ms time period to move onto DECODE or my understanding of MATCH = MATCH + 1 is wrong.
Not within the 65ms but just twice. MATCH does not get set to zero until DECODE is reached.
One good set of data could arrive then many not-goods, then one more good THEN DECODE.
Being this came from Bruce it is hard for me to question it but....
Here is what I think it should be
Code:
' Test new checksum against one received in CHK_SUM
IF CheckSum != CHK_SUM THEN MAIN ' Failed checksum, return
MATCH = MATCH + 1 ' We have a match so increment match count
' Test data bytes for match
IF (DAT_IN1) != (DAT_IN2) THEN MAIN ' Failed data comparison, return
MATCH = MATCH + 1 ' We have a match so increment match count
IF MATCH = 2 THEN DECODE ' Everything matched twice, we're good
GOTO Main ' Else do it all over
Bookmarks