Try using 396 instead of T2400 in the SERIN2 statement.
Constants like T2400 are only for SERIN (without the 2).
<br>
Try using 396 instead of T2400 in the SERIN2 statement.
Constants like T2400 are only for SERIN (without the 2).
<br>
DT
No luck. I replaced the T2400 with 396 and it made no difference. I don't believe that the serial input is the problem because I can debug with a serial LCD and I can get it to print the actual RFID tag numbers on the LCD. The problem seems to lie under Check_List:. Specifically the line...
READ (tagNum - 1 * 10 + idx), char ' get tag data from table
I've never saved anything to EEPROM before. Maybe its not reading it correctly? Or saving it?
Can you post your complete code?
I have to understand what are youīre trying to do.
regards Rob
You might try using WRITE to store the data. That might isolate the problem to your DATA or READ statements.
Maybe this one will help you.
I donīt try before working with SERIN2 but give it a try. You can change this part with storing data to eeprom too. Itīs only to see how to realize that, if iīm not wrong.
To store data on eeprom use
DATA @$00,$D7,$7C,$4B,$02,$2D,$C9,$80,$3A,$C4,$72
Code:Loop VAR BYTE ReadTag VAR BYTE[2] ConvTag VAR WORD Tag VAR WORD[5] Tag(1) = $D77C Tag(2) = $4B02 Tag(3) = $2DC9 Tag(4) = $803A Tag(5) = $C472 ' -----[ Program Code ]---------------------------------------------------- Main: LOW PORTB.3 ' activate the reader SERIN2 PORTB.2, T2400, [WAIT($0A,"100050"), STR ReadTag\2] HIGH PORTB.3 ' deactivate reader Check_List: ConvTag = ReadTag(0)*$100 + ReadTag(1) FOR Loop = 1 to 5 IF ConvTag = Tag(Loop) THEN Tag_found NEXT Loop GOTO Bad_Char Bad_Char: ' try next tag '.... '.... GOTO main Tag_Found:
Are you sure you're programming your tag numbers in EEPROM at burn time? You should be
able to read back the .hex after programming to check.
I donīt wrote the code before for storing on eeprom.
But maybe this could work
Error corrected... SorryCode:DATA @$00, $D7, $7C, $4B, $02, $2D, $C9, $80, $3A, $C4, $72 Loop VAR BYTE ReadTag VAR BYTE[2] Tag VAR WORD[5] TmpTag VAR BYTE[10] ConvTag VAR WORD ' -----[ Program Code ]---------------------------------------------------- FOR Loop= 0 TO 9 ' Reading Data from EEprom Adr: $00 -$09 READ Loop,TmpTag(Loop) NEXT Loop Main: LOW PORTB.3 ' activate the reader SERIN2 PORTB.2, T2400, [WAIT($0A,"100050"), STR ReadTag\2] HIGH PORTB.3 ' deactivate reader Check_List: FOR Loop = 0 TO 8 STEP 2 ' Calculate Word from HighByte + LowByte Tag(Loop/2) = TmpTag(Loop)*$100+TmpTag(Loop+1) NEXT Loop ConvTag = ReadTag(0)*$100+ReadTag(1) ' Conversion of ReadTag to WORD FOR Loop = 0 TO 4 ' Compare if ReadTag compares to Database in Eeprom IF ConvTag = Tag(Loop) THEN Tag_found NEXT Loop GOTO Bad_Char Bad_Char: ' try next tag '.... '.... GOTO main Tag_Found:
Last edited by Robson; - 25th August 2007 at 18:16.
Bookmarks