How to compare strings/array? RFID Project


Closed Thread
Page 1 of 3 123 LastLast
Results 1 to 40 of 101
  1. #1
    Join Date
    Aug 2007
    Posts
    7

    Question How to compare strings/array? RFID Project

    I am trying to make an RFID reader using Parallax's RFID Reader Module and a PIC 16F628A.
    I am using PBP and am having troubles figuring out how to convert over the sample code found at Parallax to work in PBP.
    Sample code: http://www.parallax.com/dl/src/prod/RFID1.BS2

    The main trouble I am having is getting the comparison to work. I'm not sure what the best way would be to compare the scanned RFID 10 byte string array against a set of known tags.
    Below is the part of the code I believe is not working right.
    Does anybody have any idea on what I can do to fix this or perhaps someone has a better way of doing it? Thanks in advance!
    -Dan

    ' -----[ EEPROM Data ]-----------------------------------------------------
    Tag1 DATA "100050D77C" ' valid tags
    Tag2 DATA "1000504B02"
    Tag3 DATA "1000502DC9"
    Tag4 DATA "100050803A"
    Tag5 DATA "100050C472"

    ' -----[ Program Code ]----------------------------------------------------
    Main:
    LOW portb.3 ' activate the reader
    SERIN2 portb.2, T2400, [WAIT($0A), STR buf\10] ' wait for hdr + ID
    HIGH portb.3 ' deactivate reader

    Check_List:
    FOR tagNum = 1 TO LastTag ' scan through known tags
    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 Bad_Char ' compare tag to table
    NEXT
    GOTO Tag_Found ' all bytes match!
    Bad_Char: ' try next tag
    NEXT
    Last edited by dan-tron; - 25th August 2007 at 01:18. Reason: Typo in title

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Try using 396 instead of T2400 in the SERIN2 statement.

    Constants like T2400 are only for SERIN (without the 2).
    <br>
    DT

  3. #3
    Join Date
    Aug 2007
    Posts
    7


    Did you find this post helpful? Yes | No

    Default

    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?

  4. #4
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    44


    Did you find this post helpful? Yes | No

    Default

    Can you post your complete code?
    I have to understand what are you´re trying to do.

    regards Rob

  5. #5
    Join Date
    Dec 2005
    Posts
    1,073


    Did you find this post helpful? Yes | No

    Default

    You might try using WRITE to store the data. That might isolate the problem to your DATA or READ statements.

  6. #6
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    44


    Did you find this post helpful? Yes | No

    Default

    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:

  7. #7
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    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.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  8. #8
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    44


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Bruce View Post
    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
    Code:
    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:
    Error corrected... Sorry
    Last edited by Robson; - 25th August 2007 at 19:16.

  9. #9
    Join Date
    Aug 2007
    Posts
    7


    Did you find this post helpful? Yes | No

    Default

    I have simplified my program to isolate the issue. I believe it lies with the READ command. This is my simplified code.

    Code:
    CMCON = 7   
    DEFINE OSC 20
    
    char            VAR     Byte                    ' character from table
    
    ' - LCD Stuff -
    i con 254
    clrlcd con 1
    cgram con 64
    ddram con 128
    n96n con $4054
    pause 1000
    serout2 portb.7,n96n,[i,clrlcd]
    pause 1
    
    Tag1 DATA @$00,$10,$2A,$54,$FF,$7C
    
    Main:
    
    READ $02, char        ' get tag data from table
    
    'Debug to LCD
    serout2 portb.7,n96n,[i,clrlcd]
    pause 500
    serout2 portb.7,n96n,[i,ddram+0]
    serout2 portb.7,n96n,[HEX char]
    serout2 portb.7,n96n,[i,ddram+6]
    serout2 portb.7,n96n,[DEC char]
    pause 1000
    
    end
    At this point I am just trying to read a byte form the EEPROM and display it on the LCD just to prove it is being read. I see the EEPROM data in the EEPROM data window on my EPICWin programming software. So I guess it is writing the EEPROM data at burn time. However all I can debug on the LCD so far is just 0. This leads me to think that the problem is with the READ command. With the above example I would think that the LCD would display 2A or at least something other than just 0's.

  10. #10
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    "Program/Verify Data" must be checked for it to write EEPROM data when programming.

    <img src="http://www.picbasic.co.uk/forum/attachment.php?attachmentid=1940&stc=1&d=118807518 2">
    <br>
    Attached Images Attached Images  
    DT

  11. #11
    Join Date
    Aug 2007
    Posts
    7


    Did you find this post helpful? Yes | No

    Default

    I already have the "Program/Verify Data" option checked. Also if I Read the chip after Programming it, I do see the EEPROM data present in the Data EEPROM window. So it's definitely writing to the EEPROM. It's just not reading it for some reason.

    Also some other things I tried just now was switching to the internal 4MHz resonator and trying a second chip in case it was a bad chip. Neither made any difference.

  12. #12
    Join Date
    Aug 2007
    Posts
    7


    Did you find this post helpful? Yes | No

    Default

    Ok, get this! I just tried using a 16F84A instead of the 16F628A using nearly the exact same code and it works! I just removed the CMCON = 7 and DEFINE OSC 20 and stuck a 4MHz resonator on the board. With the 84A the LCD reads out the proper values one after the other, 10,2A,54,FF,7C. So now it looks like there is either something weird happening when I compile or the 628A does not like this code. Any ideas? I'd rather not have to step down my chip for this and have to order more old 16F84A's.

    Code:
    'CMCON = 7
    'DEFINE OSC 20
    
    char            VAR     Byte                    ' character from table
    loop var byte
    
    i con 254
    clrlcd con 1
    cgram con 64
    ddram con 128
    n96n con $4054
    pause 1000
    serout2 portb.7,n96n,[i,clrlcd]
    pause 1
    
    DATA @$00,$10,$2A,$54,$FF,$7C
    
    Main:
    for loop = 0 to 4
    READ loop, char        ' get tag data from table
    
    'Debug to LCD
    serout2 portb.7,n96n,[i,clrlcd]
    pause 500
    serout2 portb.7,n96n,[i,ddram+0]
    serout2 portb.7,n96n,[HEX char]
    pause 1000
    
    next
    end

  13. #13
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Change this: READ (tagNum - 1 * 10 + idx), char ' get tag data from table

    to this: (((tagNum - 1) * 10) + idx), char ' get tag data from table

    Does it work now?
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  14. #14
    Join Date
    Aug 2007
    Posts
    7


    Did you find this post helpful? Yes | No

    Smile

    EUREKA!
    Thanks guys! You have been a huge help. I have finally figured it out.
    My problem was more like 3 problems...

    1. I have never done EEPROM stuff before so I was lost to begin with.
    2. As Bruce pointed out, the mathematical order of operations in one line was not correct. I guess the BS2 thinks a little differently from PBP in that respect.
    3. My PicBasic Pro compiler was Version 2.30 form 2000. It seems that v2.30 supports the PIC 16F628 but the PIC 16F628A was implemented in a later version. I have upgraded my PBP to version 2.47 and now the EEPROM features work correctly on the 16F628A. When I successfully tested a 16F84A using the same code, that lead me to question the compiler.

    So for future generations and the benefit of other people like me, here's my WORKING code that is tested successfully on a PIC 16F628A with a 20MHz resonator compiled using PBP v2.47. It reads data from the Parallax RFID Reader Module, compares it against known values stored in EEPROM and allows or denies access accordingly. Enjoy.

    Code:
    CMCON = 7   
    DEFINE OSC 20	'Set oscillator in MHz
    
    ' -----[ Variables ]-------------------------------------------------------
    
    buf	VAR	Byte(10)	' RFID bytes buffer
    tagNum	VAR	Byte	' from EEPROM table
    idx	VAR	Byte	' tag byte index
    char	VAR	Byte	' character from table
    
    ' -----[ EEPROM Data ]-----------------------------------------------------
    
    Tag1	DATA	"100050A4B7"
    Tag2	DATA	"1000508E0A"
    Tag3	DATA	"10005091DC"
    Tag4	DATA	"100050203A"
    Tag5	DATA	"100050DA36"
    
    ' -----[ Initialization ]--------------------------------------------------
    
    HIGH portb.3	' turn off RFID reader
    LOW portb.6	' lock the door!
    Low portb.4	'Turn off LED
    
    ' -----[ Program Code ]----------------------------------------------------
    
    Main:
    
    LOW portb.3				' activate the reader
    SERIN2 portb.2, 396, [WAIT($0A), STR buf\10]	' wait for hdr + ID
    HIGH portb.3				' deactivate reader
    
    Check_List:
      FOR tagNum = 1 to 5			' scan through known tags
        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 Bad_Char		' compare tag to table
        NEXT
        GOTO Tag_Found				' all bytes match!
    Bad_Char:					' try next tag
      NEXT
    
    Bad_Tag:
      tagNum = 0
      FREQOUT portb.5, 1000 */ $100, 115 */ $100	' groan
      PAUSE 1000
      GOTO Main
    
    Tag_Found:
      HIGH portb.6				' remove latch
      High portb.4				' Light LED
      FREQOUT portb.5, 2000 */ $100, 880 */$100	' beep
      LOW portb.6				' restore latch
      Low portb.4				' LED OFF
      GOTO Main

  15. #15
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    The BASIC Stamp solves math problems in the order they are written; from left to right. The
    result of each operation is fed into the next operation. So to compute -
    Code:
        12 + 3 * 2 / 5
    
    ...the BASIC Stamp goes through a sequence like this:
    
        12 + 3 = 15
        15 * 2 = 30
        30 / 5 = 6
    Unlike the BASIC Stamp, the PBP Compiler performs all math operations in full hierarchal
    order. This means that there is precedence to the operators.

    Multiplies and divides are performed before adds and subtracts, for example:
    Code:
        12 + 3 * 2 / 5
    
    ...PBP goes through a sequence like this:
    
        3 * 2 = 6    multiply first
        6 / 5 = 1.2  divide second (the .2 is lost)
        12 + 1 = 13  add last
    Forcing the addition first with parenthesis like: (12 + 3) * 2 / 5 would return the correct
    result. Good stuff to remember when porting BASIC Stamp code over to PBP.

    I haven't played with a BASIC Stamp in years, but once I looked in the Stamp editor help
    file under PBASIC Operators, it was obvious. I'm glad you got it working. Looks like a
    fun project.

    Maybe you could post your final version in the code examples section? Could save someone
    else using the Parallax RFID components with PBP a lot of head-scratching...;o}
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  16. #16
    Join Date
    Nov 2008
    Location
    Fort Collins, Colorado
    Posts
    8


    Did you find this post helpful? Yes | No

    Default RFID troubles

    I know I'm resurrecting a dead thread here but I've searched and can't quite find what i'm looking for. I'm using a Parallax RFID reader and a PIC 16F88, with a 4 line LCD. Right now I'm just trying to get the tag ID's to display on the LCD. So far I can get the RFID to turn on and read a tag, but the information sent to the display is cryptic. I would appreciate any help you might be able to give. Thanks!

    Here's the code I have so far.


    Code:
    'RFID and LCD test
    
    DEFINE OSC8
    OSCCON=%01110000
    
    ANSEL=0
    
    led		VAR PORTB.3	'led
    rx		VAR PORTB.0	'Serial input from RFID reader
    lcd		VAR PORTB.5	'Serial Output to LCD 
    rfid	VAR PORTB.1	'Enable rfid  low= on
    
    buf		VAR BYTE(10)	'Tag code stored as word
    
    Pause 1000
    
    High rfid
    
    High led
    Pause 1000
    Low led
    
    SEROUT lcd,0,[$FE,1]
    SEROUT lcd,0,[$FE,1,"Test"]
    
    Pause 4000
    
    High led
    Pause 3000
    Low led
    
    low rfid
    
    SERIN2 rx,396,[Wait($0A ),STR buf\10]
    
    High rfid
    
    High led
    Pause 2000
    Low led
    
    Pause 500
    SEROUT lcd,0,[$FE,1]
    SEROUT lcd,0,[$FE,1,"Tag number"]
    SEROUT lcd,0,[$FE,$C0,buf]
    Last edited by CSU_2010; - 20th November 2008 at 20:09.

  17. #17
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    try with SEROUT2 and use the STR modifier.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  18. #18
    Join Date
    Nov 2008
    Location
    Fort Collins, Colorado
    Posts
    8


    Did you find this post helpful? Yes | No

    Default

    Thanks, I tried SERIN2 and SEROUT 2, the LCD is still displaying weird symbols. It displays eveything else ok. Here's the code:


    Code:
    'RFID and LCD test
    
    'Author Joshua Reynolds
    'November 20th, 2008
    'Rev. 1	
    
    'Configuring the 16F88 chip
    
    DEFINE OSC 8			'Internal Oscillator set to 8mhz
    OSCCON.4=1
    OSCCON.5=1
    OSCCON.6=1
    
    ANSEL=0				'Turns off A/D converter
    
    '------Define I/O pin names
    rx		VAR PORTB.1	'Serial input from RFID reader
    rfid	VAR PORTB.2	'Enable rfid  low= on
    led		Var PORTB.3	
    lcd		Var	PORTB.5
    
    buf		VAR BYTE(10)	'Tag code stored as word
    
    '------Declare Variables
    
    key_value 	Var BYTE	'code byte from the keypad
    
    
    High led
    Pause 1000
    Low led
    
    '------Wait .5 sec for everything to power up
    Pause 500
    
    loop:
    
    SEROUT lcd,0,[$FE,1]
    SEROUT lcd,0,[$FE,1,"Read tag"]
    
    low rfid
    serin2 rx,396,[str buf\10]
    high rfid
    
    High led
    Pause 500
    low led
    Pause 500
    High led
    Pause 500
    low led
    
    SEROUT lcd,0,[$FE,1,"One"]
    Pause 4000
    	
    SEROUT lcd,0,[$FE,1,"Tag Number"]
    
    Pause 2000
    
    SEROUT2 lcd,396,[$FE,$C0,STR buf\10]
    
    Pause 5000
    
    Goto loop
    
    End					'End of main program

  19. #19
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Try something, start a new code, fill the buf Array with some data (ASCII character), then send it to your LCD.

    Any link for your RFID reader?
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  20. #20
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Maybe not a bad idea to connect the RFID to your PC to see what happen... you'll need a MAX232 or any other level converter to do that.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  21. #21
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Just curious to know if the following line work with your LCD
    Code:
    SEROUT2 lcd,396,[$FE,$C0,"2nd Line???"]
    Last edited by mister_e; - 20th November 2008 at 20:57.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  22. #22
    Join Date
    Nov 2008
    Location
    Fort Collins, Colorado
    Posts
    8


    Did you find this post helpful? Yes | No

    Default

    Thanks for the replies, I'll try it out in lab tomorrow. Here's a link to the RFID Parallax RFID
    I'll have to look up the stuff on attaching it to a computer, I've never done anything like that.

  23. #23
    Join Date
    Nov 2008
    Location
    Fort Collins, Colorado
    Posts
    8


    Did you find this post helpful? Yes | No

    Default

    I'm trying to find out the RFID tag ID by reading the tag and displaying it on an LCD and I can't seem to figure it out. Has anyone else been able to display the tag ID on an LCD?

  24. #24
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default RFID reader for cheap

    I was at Radio Shack yesterday, trying to buy a breadboard. (No of course they didn't have it, why would my store have it in stock?)

    Anyway, I was searching their bins and I saw a Parallax RFID READER WITH TAGS part number 276-0032, or this part: http://www.parallax.com/Store/Sensor...%2cProductName

    It didn't have a price marked, so I had the lady scan it, and she told me it was $19.97. It's on my receipt as the correct part number, and correct product description. That's half off of Parallax's price, so if you are interested in RFID, you might want to check it out at Radio Shack.

  25. #25
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,793


    Did you find this post helpful? Yes | No

    Default

    At their site they do not list it though...

    Ioannis

  26. #26
    Join Date
    Nov 2006
    Location
    Murrieta, CA
    Posts
    62


    Did you find this post helpful? Yes | No

    Thumbs up Video of working RFID Project + uOLED

    i thought id post it here.. since this thread helped in the trick math operation.

    My Board runs a PIC16F877A @ 20Mhz

    Video Here

    Code:
    define OSC 20
    ADCON1=7
    CMCON=7
    
    
    LastTag         CON     3
    X               VAR     byte
    tagNum          VAR     byte                     ' from EEPROM table
    idx             VAR     Byte                    ' tag byte index
    char            VAR     Byte                    ' character from table
    buf             var     byte(10)
    
    '*****************************************************************
    
    SYMBOL PWRLED = PORTB.2 'Software controlled power LED
    SYMBOL RFID   = PORTC.5  'RFID /ENABLE
    
    
    '*****************************************************************
    
    
    Tag1 DATA  "0415146D53"  ' 2 cards registered...
    Tag3 DATA  "30700D48A5" 
    
    
    '*****************************************************************
    
    
    HIGH PWRLED
    HIGH RFID
    PAUSE 1000
    
    serout2 PORTC.0,84,[$55]      ' uOLED Initialize
    
    '*****************************************************************
    
    Reset:
    gosub cls
    PAUSE 1000
    
    '*****************************************************************
    
    Main:
    
      LOW rfid                                    ' activate the reader
        SERIN2 PORTC.4,396,[WAIT(10),str BUF\10]  ' wait for hdr + ID
      HIGH rfid                                   ' deactivate reader
     
    Check_List:
    FOR tagNum = 1 TO lasttag
    FOR idx = 0 TO 9
    READ (((tagNum - 1) * 10) + idx), char        'The Tricky Order of Operation
    IF (char <> buf(idx)) THEN Bad_Char
    NEXT
    GOTO Tag_found
    Bad_Char:
    NEXT
    
    Bad_tag:
    FOR x = 1 TO 2
    serout2 PORTC.0,84,[$73,$6,$4,$0,$F0," ACCESS",$00]  'cmd,column,row,font,Color(msb:lsb),“string”,$00
    serout2 PORTC.0,84,[$73,$6,$8,$0,$F0," DENIED",$00]   
    NEXT
    PAUSE 4000
    GOTO reset
    
    Tag_Found:
    for x = 0 to 2
    serout2 PORTC.0,84,[$73,$6,$4,$0,$1F," ACCESS",$00]  'cmd,column,row,font,Color(msb:lsb),“string”,$00
    serout2 PORTC.0,84,[$73,$6,$8,$0,$1F," GRANTED",$00]
    next
    pause 4000
    GOTO reset
    
    
    CLS:
    FOR X = 0 TO 2
    serout2 PORTC.0,84,[$45]
    next
    return

  27. #27
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,793


    Did you find this post helpful? Yes | No

    Default

    I wonder why you send the uOLED data 2 or 3 times in a loop.

    Ioannis

  28. #28
    Join Date
    Nov 2006
    Location
    Murrieta, CA
    Posts
    62


    Did you find this post helpful? Yes | No

    Lightbulb Ahh yess the LCD refresh

    In another post someone stated about lag issues with this particular uOLED from 4Dsystems They introduced Pauses, but i found out (through trial and error) that just sending the data a couple times in a loop (refreshing) rather than putting pauses in the the display code resolved any Lag issues. As you can see in the video it displays what im sending
    to the display quite nicely and even before the RFID LED can change color.. I also dont read any ACK from the display, as it is not necessary and just slows down the process.

    Cheers!

  29. #29
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,793


    Did you find this post helpful? Yes | No

    Default

    I see. OK, thanks.

    What is you opinion about the display? (colors, brightness, sharpness).

    Ioannis

  30. #30
    Join Date
    Nov 2006
    Location
    Murrieta, CA
    Posts
    62


    Did you find this post helpful? Yes | No

    Default uOLED-128-G1 Opinion

    Overall the display is great. you have full control over any text you send to the display: positioning (x,y), Color(msb:lsb), and even font size. you can even make custom bit mapped color characters and store them on a uSD card. Or even tell the uSD to run a script.

    cmd,column,row,font,Color(msb:lsb),“string”,Termin ator ($00)

    My next goal is to have the PIC play a video from the uSD card. the only obsticle i see is you have to know a lot of information about memory structure, like sectors and such, to address the uSD card. here is the video command info:

    Command ext_cmd, cmd, x,y,width, height, colourMode, delay, frames(msb:lsb), SectorAdd(hi:mid:lo)

    - ext_cmd 40(hex) or @(ascii) : Extended Command header byte
    - cmd 56(hex) or V(ascii) : Command header byte
    - x : Video horizontal start position (top left corner).
    - y : Video vertical start position (top left corner).
    - Width: Horizontal size of the video-animation.
    - Height: Vertical size of the video-animation.
    - ColourMode 08(hex) : 256 colour mode, 8bits/1byte per pixel. 10(hex) : 65K colour mode, 16b/2B per pixel .
    - Delay : 1 byte inter-frame delay in milliseconds.
    - Frames: 2 bytes (big endian) total frame count in the video-animation clip.
    - SectorAdd : 3 bytes (big endian) sector address of a previously stored videoclip that is about to be displayed.

  31. #31
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,793


    Did you find this post helpful? Yes | No

    Default

    From the pdf that are available, I could not find the specs for the video files.

    What files the LCD can play?

    Ioannis

  32. #32
    Join Date
    Nov 2006
    Location
    Murrieta, CA
    Posts
    62


    Did you find this post helpful? Yes | No

    Thumbs up I got it

    Hey Ioannis,

    I got video to play on the display from the PIC..

    once i get the project up and complete ill write a tutorial on the process.

  33. #33
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,793


    Did you find this post helpful? Yes | No

    Default

    Okie, looking forward...

    Ioannis

  34. #34
    Join Date
    Nov 2006
    Location
    Murrieta, CA
    Posts
    62


    Did you find this post helpful? Yes | No

    Default Re: I got it

    Ioannis,

    The video Tutorial On the 4Dsystems OLED is located in the Code Example section. link below.

    Displaying Videos and Images on 4Dsystems uOLED Serially

  35. #35
    Join Date
    Oct 2010
    Posts
    411


    Did you find this post helpful? Yes | No

    Default Re: How to compare strings/array? RFID Project

    Quote Originally Posted by dan-tron View Post
    EUREKA!
    Thanks guys! You have been a huge help. I have finally figured it out.
    My problem was more like 3 problems...

    1. I have never done EEPROM stuff before so I was lost to begin with.
    2. As Bruce pointed out, the mathematical order of operations in one line was not correct. I guess the BS2 thinks a little differently from PBP in that respect.
    3. My PicBasic Pro compiler was Version 2.30 form 2000. It seems that v2.30 supports the PIC 16F628 but the PIC 16F628A was implemented in a later version. I have upgraded my PBP to version 2.47 and now the EEPROM features work correctly on the 16F628A. When I successfully tested a 16F84A using the same code, that lead me to question the compiler.

    So for future generations and the benefit of other people like me, here's my WORKING code that is tested successfully on a PIC 16F628A with a 20MHz resonator compiled using PBP v2.47. It reads data from the Parallax RFID Reader Module, compares it against known values stored in EEPROM and allows or denies access accordingly. Enjoy.

    Code:
    CMCON = 7   
    DEFINE OSC 20	'Set oscillator in MHz
    
    ' -----[ Variables ]-------------------------------------------------------
    
    buf	VAR	Byte(10)	' RFID bytes buffer
    tagNum	VAR	Byte	' from EEPROM table
    idx	VAR	Byte	' tag byte index
    char	VAR	Byte	' character from table
    
    ' -----[ EEPROM Data ]-----------------------------------------------------
    
    Tag1	DATA	"100050A4B7"
    Tag2	DATA	"1000508E0A"
    Tag3	DATA	"10005091DC"
    Tag4	DATA	"100050203A"
    Tag5	DATA	"100050DA36"
    
    ' -----[ Initialization ]--------------------------------------------------
    
    HIGH portb.3	' turn off RFID reader
    LOW portb.6	' lock the door!
    Low portb.4	'Turn off LED
    
    ' -----[ Program Code ]----------------------------------------------------
    
    Main:
    
    LOW portb.3				' activate the reader
    SERIN2 portb.2, 396, [WAIT($0A), STR buf\10]	' wait for hdr + ID
    HIGH portb.3				' deactivate reader
    
    Check_List:
      FOR tagNum = 1 to 5			' scan through known tags
        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 Bad_Char		' compare tag to table
        NEXT
        GOTO Tag_Found				' all bytes match!
    Bad_Char:					' try next tag
      NEXT
    
    Bad_Tag:
      tagNum = 0
      FREQOUT portb.5, 1000 */ $100, 115 */ $100	' groan
      PAUSE 1000
      GOTO Main
    
    Tag_Found:
      HIGH portb.6				' remove latch
      High portb.4				' Light LED
      FREQOUT portb.5, 2000 */ $100, 880 */$100	' beep
      LOW portb.6				' restore latch
      Low portb.4				' LED OFF
      GOTO Main
    hello all,

    i would like to see the schematic of the above code if it is possible.

    One more thing that i would like to incude at the code is to identify the name of the target id.

    For example, once you pass the RFID chip from the reader, on the display to give you the name of the carrier.

    if i have a chip with a target id : 123456789012 then i would like once i pass it from the reader to give a name like ASTANAPANE.

    I guess that on the code i have to corespond the name to the target id.

    How can we do that.

    I have bought the modules from SPARKFUN and the RFID chips also from them.

    I would like to make a small project for my room.

    thanks for any suggestions.

    Best Regards
    Last edited by astanapane; - 28th March 2011 at 11:45.

  36. #36
    Join Date
    Nov 2006
    Location
    Murrieta, CA
    Posts
    62


    Did you find this post helpful? Yes | No

    Lightbulb Re: How to compare strings/array? RFID Project

    Check_List:
    FOR tagNum = 1 to 5 ' scan through known tags
    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 Bad_Char ' compare tag to table
    NEXT
    GOTO Tag_Found ' all bytes match!
    Bad_Char: ' try next tag
    NEXT
    whenever the PIC identifies a tag stored in the EEPROM it still holds onto the "tagNum" variable. from there you can have your program branch off with the "tagNum" variable to display whatever you want. for argument sake lets say your third RFID badge is yours then:

    Code:
    Tag_Found:
    IF tagNum = 3 then displayName
    GOTO Main
    
    displayName:
    Serout2 portc.0,84,["ASTANAPANE"]    'assuming your display is on portc.0 @ 9600 baud
    pause 5000                                       'Pause 5 sec then clear display
    gosub CLRLCD
    Goto main
    Hope this helps... Cheers

  37. #37
    Join Date
    Oct 2010
    Posts
    411


    Did you find this post helpful? Yes | No

    Default Re: How to compare strings/array? RFID Project

    thank you very much for the help....

    i ordered the reader and the ID-12 from SPARKFUN, and i wait for them next week. Once i get them i will start to built my project.

    I will make schematics and PCBs and i will post them here.

    A lot of thanks for the code. I only need a little bit help of the code you made corresponding to the schematic.

    If you dont have time i will read the code and identify the Pins for the pic16f628.

    thank you very much again for your help.

    I dont see the time to have the reader and the rfid chips with me.

    Kind Regards,

  38. #38
    Join Date
    Oct 2010
    Posts
    411


    Did you find this post helpful? Yes | No

    Default Re: How to compare strings/array? RFID Project

    i have also one more question please.

    I need to use the ID-12 with a display also. Can i use the pic16f628a to run both?

    thank you very much.

  39. #39
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default Re: How to compare strings/array? RFID Project

    Quote Originally Posted by astanapane View Post
    i have also one more question please.

    I need to use the ID-12 with a display also. Can i use the pic16f628a to run both?

    thank you very much.
    Go read your manual about LCDOUT, it explains in a thorough treatise exactly how to do that. I am perceiving this to be a school project, and it would be rather easy to hand you the code, I think that would do you more harm than good.
    What you learn here you can then teach to someone else, that is how this forum works, a great many of the members ARE engineers, others are just interested hobbyist, and IF you are a student, as I believe, I do not want to enable you to fail and NO I do not mean fail the class. Write your code, Make the mistakes, Show us the mistakes, and receive help.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  40. #40
    Join Date
    Oct 2010
    Posts
    411


    Did you find this post helpful? Yes | No

    Default Re: How to compare strings/array? RFID Project

    sorry Joe.

    i dont want to start that with student or not. If you think that i'm a student you might be right.

    A student that is graduated from E.E.E. and i didnt like it then gradueated with MSc DATA COMS with Distinction and i only know to do CISCO. If someone will ask me about cisco i will help him with all my stength and examples.

    Sorry i didnt like a lot my first degree thats why i dont know how to use programming very well.

    Right now i;m working for a reseller company of Stratasys which makes the FORTUS RP systems.

    I only want to make a small project for my father's home.

    I'm not a programmer or student sorry....i just do not have enouph time to spend on this.

    I will try by my self and i will ask for your help.

    thanks.

Similar Threads

  1. Parallax RFID Reader code example
    By dan-tron in forum Code Examples
    Replies: 4
    Last Post: - 19th April 2013, 23:16
  2. A Temperature & Humidity Data Recorder Project
    By Oldspring in forum Off Topic
    Replies: 0
    Last Post: - 9th July 2008, 19:47
  3. Replies: 3
    Last Post: - 12th March 2008, 06:33
  4. Free Web based RFID Online Courses
    By Thirumoorthy in forum General
    Replies: 0
    Last Post: - 19th November 2007, 14:38
  5. Free web based RFID online Course
    By Lesikar in forum GPS
    Replies: 0
    Last Post: - 19th October 2007, 23:28

Members who have read this thread : 2

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts