
Originally Posted by
andybarrett1
Need to get a simulator working really or a debug out !
This is exactly what you need to do.
Yes when the DATA places the Tag in the EEPROM the largest number is in 0 and smallest in 9
DATA "1400434B9C"
locatn 0123456789
and when the Tag is read into buf
buf 1400434B9C
idx 9876543210
which obviously is the opposite order, well obvious when explained.
Code:
FOR idx = 0 TO 9 ' scan bytes in tag
READ (((tagNum-1) * 10) + idx), char ' get tag data from table
IF (char != buf(idx)) THEN goto nextTag
Next
To repeat myself in the above code when idx is 0 char will be 1 and buf(0) will be C.
You could reverse the order in the DATA statement but this could become a burden if you have thousands of Tags. A neater solution is to change the code.
Code:
FOR idx = 0 TO 9 ' scan bytes in tag
READ (((tagNum-1) * 10) +9- idx), char ' get tag data from table
IF (char != buf(idx)) THEN goto nextTag
Next
Let me know if I am wrong because I hate misleading posts.
Bookmarks