How to compare strings/array? RFID Project


Closed Thread
Results 1 to 40 of 101

Hybrid View

  1. #1
    Join Date
    Oct 2010
    Posts
    413


    Did you find this post helpful? Yes | No

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

    Dear All,

    thank you very much for your help. Ioannis helped me out to identify my mistakes on the code and he also gave me the right instructions in order to solve the problem.

    i would like also to thanks, Joe, Bruce and Gevo for their support.

    Please find attached pictures of my circuit.
    Attached Images Attached Images     

  2. #2
    Join Date
    Oct 2010
    Posts
    413


    Did you find this post helpful? Yes | No

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

    now the next and most difficult part is to configure the code for GLCD use.

    But i havent seen any library for GLCD. Some users in here have been working for many hours to built a standard code for GLCDs.

    the problem is that there would be much better if a library were available from PIC BASIC.

    i know and understand that will take place on the pic chip but in nowadays we all using more powerfull pic's.

    Regards,

    Leonardo

  3. #3
    Join Date
    Sep 2009
    Posts
    755


    Did you find this post helpful? Yes | No

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

    You might find something interesting here
    http://www.picbasic.co.uk/forum/show...009#post102009

  4. #4
    Join Date
    Oct 2010
    Posts
    413


    Did you find this post helpful? Yes | No

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

    here you can see a demo of the RFID circuit.



    I need now to improve it with GLCd and Keypad.

    i would like to say thanks to Mr. Ioannis for his patient and help.

    regards,

  5. #5
    Join Date
    May 2007
    Posts
    604


    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 need now to improve it with GLCd and Keypad.
    If this is a one-off (which it appears to be) and price is not an overwhelming obstacle, then look at a serial Graphic LCD such as this one http://www.sparkfun.com/products/9351
    Besides writing text, this serial graphic LCD allows the user to draw lines, circles and boxes, set or reset individual pixels, erase specific blocks of the display, control the backlight and adjust the baud rate. It costs $35 and you won't need a GLCD library.

    Better yet, this full color TFT has a built-in touch screen so you won't need a keyboard http://www.sparkfun.com/products/10089 - it costs more at $85 and is fully programmable OR can can be controlled with a serial port.

    Why pay for overpriced toys when you can have
    professional grade tools for FREE!!!

  6. #6
    Join Date
    Oct 2010
    Posts
    413


    Did you find this post helpful? Yes | No

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

    hello rmteo,

    thanks for your advice.

    I dont know about the serial lcd. Can i drive it form a pic18f4550 for example?

    Could you give me some instructions? a sample code? I will first use the serial lcd and then i will try the color.

    How is the serial GLCD working, and why i dont need a GLCD library? As i see on the serial there is an ATEML chip. I dont know how to programm ATMEL. Sorry for my questions.

    Thank you very much for any help in advance.

    Kind regards,

    astanapane.

  7. #7
    Join Date
    May 2007
    Posts
    604


    Did you find this post helpful? Yes | No

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

    The serial GLCD can be used with any MCU (including the PIC184550) that can output serial data. You do not need a GLCD library as it is an intelligent display that has an AtmelAVR MCU on board - you could say that the library lives in the AVR.

    I do not provide sample code. You send simple ASCII codes using SEROUT (or HSEROUT) at up to 115,200 baud. Take a look at the datasheet here http://www.sparkfun.com/datasheets/LCD/Monochrome/Corrected-SFE-0016-DataSheet-08884-SerialGraphicLCD-v2.pdf and and the tutorial here http://www.sparkfun.com/tutorials/120
    Why pay for overpriced toys when you can have
    professional grade tools for FREE!!!

  8. #8


    Did you find this post helpful? Yes | No

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

    Quote Originally Posted by astanapane View Post
    Dear All,

    thank you very much for your help. Ioannis helped me out to identify my mistakes on the code and he also gave me the right instructions in order to solve the problem.

    i would like also to thanks, Joe, Bruce and Gevo for their support.

    Please find attached pictures of my circuit.

    Dear astanapane,

    Publications of the source code of the forum. Çok güzel proje. Ben de yapmak isterim. Thanks.

  9. #9


    Did you find this post helpful? Yes | No

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

    Publications of the source code of the forum. Very nice project. I'd like to. Thanks

  10. #10
    Join Date
    Oct 2010
    Posts
    413


    Did you find this post helpful? Yes | No

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

    apologize for my absent so many years.

    I was working in Dubai for 4 years and really didnt have a time to login. I have more than a flight per day, so you understand that i wasnt able at all to handle many things at a time.

    Now im back to real life, and i will upload the code and the circuits as well tonight.

    Imagine that for so long time, the circuit remains the same in my lab, and i havent done anything to it yet apart from adding a second circuit, beside it with a keypad.

    None of the core of the codes are mine, i just did some configurations and changes to fit my needs. (im not proud of this, as i would like ones to write completely my own code from the scratch)

    The following image shows the circuit and the connection of one circuit to an other.

    Name:  rfid.jpg
Views: 825
Size:  555.8 KB

    I know that it is difficult to understand the schematic, as it is not corresponds at the moment to a circuit, but i have it on a TEST Board and i can do a small video of it.

    As i have mentioned, there are two circuits, separated, the RFID circuit (with the uLCD) and the CODELOCK with keyboard.

    What the circuit does:

    1) once you place the Tag to the RFID reader, the uLCD, displays the picture of the person carries the RFID tag
    2) at the same time, a BEEP on the buzzer is activated and sends a command to activate the second circuit.
    3) You have 5 seconds until you add the code on the keypad otherwise the circuit lose its power and is not activated any more.

  11. #11
    Join Date
    Oct 2010
    Posts
    413


    Did you find this post helpful? Yes | No

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

    the code for the RFID PIC16F88 chip

    Code:
    '*  Author  : LEONARDO BILALIS                                  *
    '*  Notice  : Copyright (c) 2017 [LEONARDOS BILALIS]            *
    '*          : All Rights Reserved                               *
    '*  Date    : 19/3/2017                                         *
    '*  Version : 1.3                                               *
    '*  Notes   : This is an RFID ACCESS control with ulcd          * 
    '*          : and an interrupt LED on portb.3                   *
    '****************************************************************
    @ ERRORLEVEL -306 ; this command prevents the compiler to give you a notice of
                      ; crossing page boundary - make sure bits are set 
    Include "MODEDEFS.BAS"
    INCLUDE "DT_INTS-14.bas"     ' Base Interrupt System
    INCLUDE "ReEnterPBP.bas"     ' Include if using PBP interrupts
    DEFINE OSC 8	
    OSCCON=%01111000	 '8 Mhz
    CMCON = 7	         'turn comparators off
    ANSEL = 0                'All digital
    
    ;wsave   VAR BYTE    $20     SYSTEM      ' location for W if in bank0
    wsave   VAR BYTE    $70     SYSTEM      ' alternate save location for W 
                                             ' if using $70, comment wsave1-3
    
    ' --- IF any of these three lines cause an error ?? ------------------------
    '       Comment them out to fix the problem ----
    ' -- Which variables are needed, depends on the Chip you are using -- 
    wsave1  VAR BYTE    $A0     SYSTEM      ' location for W if in bank1
    wsave2  VAR BYTE    $120    SYSTEM      ' location for W if in bank2
    wsave3  VAR BYTE    $1A0    SYSTEM      ' location for W if in bank3
    
    ;-----------------------------------------------------------------
    LED   VAR  PORTb.3   ; this is the operation led
      
    ASM
    INT_LIST  macro    ; IntSource,        Label,  Type, ResetFlag?
            INT_Handler   TMR1_INT,  _ToggleLED1,   PBP,  yes
        endm
        INT_CREATE               ; Creates the interrupt processor
    ENDASM
    
    T1CON = $31              ; Prescaler = 8, TMR1ON
    @ INT_ENABLE  TMR1_INT     ; enable Timer 1 interrupts
    ;-----------------------------------------------------------------
    ' -----[ 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
    x           var byte
    Symbol PWRLED  = PORTB.1   ; this shows that the initialization is finished and is ready for the RFID tag
    symbol LCD     = PORTB.5   ; to LCD operation
    Symbol rfidin  = PORTB.2   ; from RFID 
    Symbol GROAN   = PORTB.7   ; goes to groan when the rfid is denied
    Symbol TXRXIN  = PORTB.0   ; this is the RX input signal from the other circuit
    pause 2000
    
    serout2 LCD,32,[$55]      ' uOLED Initialize
    pause 2000
    serout2 lcd,32,[$56,$01]
    pause 1000
    serout2 lcd,32,[$45]
    pause 500
    serout2 lcd,32,[$55]
    pause 500
    serout2 lcd,32,[$45]
    pause 500
    serout2 lcd,32,[$73,$00,$03,$11,$ff,$ff," Leonardo Bilalis",$00]
    pause 200
    serout2 lcd,32,[$73,$02,$06,$10,$ff,"     Copyright 2017",$00]
    pause 3000
    serout2 lcd,32,[$45]
    pause 1000
    high pwrled                  'Software controlled Power LED (if this LED is not on at load check your code)
    ' -----[ EEPROM Data ]-----------------------------------------------------
    
    Tag1	DATA  "xxxxxxxxxx"
    Tag2	DATA  "xxxxxxxxxx"
    Tag3    data  "xxxxxxxxxx"
    Tag4    data  "xxxxxxxxxx"
    Tag5    data  "xxxxxxxxxx"
    Tag6    Data  "xxxxxxxxxx"
    Tag7    data  "xxxxxxxxxx"
    Tag8    data  "xxxxxxxxxx"
    Tag9    data  "xxxxxxxxxx"
    Tag10   data  "xxxxxxxxxx"
    
    ' -----[ Initialization ]--------------------------------------------------
    LOW portb.4	    ' lock the door!
    
    '----- [ LOGO ] ---------------------------------------------------------------
    logo:
    serout2 LCD,32,[$55]      ' uOLED Initialize
    pause 500 
    gosub Logo_png
    
    ' -----[ Program Code ]----------------------------------------------------
    
    Main:
    serin2 portb.2,84,[WAIT($02),str BUF\10]
    pause 500
                                    
    Check_List:
      FOR tagNum = 1 to 10       ' 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
        serout2 lcd,32,[$59,$03,$01]
        pause 1000
        serout2 lcd,32,[$40, $49, $00, $00, $80, $80, $10, $00, $00, $C0]
        pause 500
        FREQOUT groan, 1000 */ $100, 115 */ $100	' groan
        pause 500
        serout2 lcd,32,[$45]
        pause 500
        serout2 lcd,32,[$59,$03,$00]
        pause 200
        goto main
       
    Tag_Found:
    IF tagNum = 1 then Leonardo       
    
    IF tagNum = 2 then ELENI         
    
    if tagnum = 3 then MAMAANNA       
    
    if tagnum = 4 then THEIAMARIA     
    
    if tagnum = 5 then MARIA          
    
    if tagnum = 6 then displayName6
    
    if tagnum = 7 then displayName7
    
    if tagnum = 8 then displayName8
    
    if tagnum = 9 then displayname9
    
    if tagnum = 10 then displayname10
    
    GOTO main
    
    Leonardo:
        serout2 lcd,32,[$59,$03,$01]
        pause 1000
        serout2 lcd,32,[$40, $49, $00, $00, $80, $80, $10, $00, $00, $40]
        pause 500       'Pause ,5 sec then clear display
        goto open_door
    
    ELENI:
        serout2 lcd,32,[$59,$03,$01]
        pause 1000
        serout2 lcd,32,[$40, $49, $00, $00, $80, $80, $10, $00, $00, $00]
        pause 500    'Pause ,5 sec then clear display
        goto open_door
    
    MAMAANNA:
        serout2 lcd,32,[$59,$03,$01]
        pause 1000
        serout2 lcd,32,[$73,$00,$03,$11,$ff,$ff," Thank you ANNA",$00]
        pause 200
        serout2 lcd,32,[$73,$02,$06,$10,$ff,"   Please enter code",$00]
        pause 500
        goto open_door
        
    THEIAMARIA:
        serout2 lcd,32,[$59,$03,$01]
        pause 1000
        serout2 lcd,32,[$73,$00,$03,$11,$ff,$ff," Thank you MARIA",$00]
        pause 200
        serout2 lcd,32,[$73,$02,$06,$10,$ff,"    Please enter code",$00]
        pause 500
        goto open_door
    
    MARIA:
        serout2 lcd,32,[$59,$03,$01]
        pause 1000
        serout2 lcd,32,[$73,$00,$03,$11,$ff,$ff," Thank you MARIA",$00]
        pause 200
        serout2 lcd,32,[$73,$02,$06,$10,$ff,"    Please enter code",$00]
        pause 500
        goto open_door
    
    
    displayName6:
    
    
    displayName7:
    
    
    displayName8:
    
    
    displayName9:
    
    displayName10:
    '----------------------OPEN THE DOOR------------------------------    
    open_door:
        HIGH portb.4          ' remove latch
        pause 5000
        if TXRXIN = 1 then  
        pause 8000
        endif  
        LOW portb.4		' restore latch
        serout2 lcd,32,[$45]
        pause 500
        serout2 lcd,32,[$59,$03,$00] 
        goto main
    
     ;DOOR:
     ;  serout2 lcd,32,[$45]
     ;  serout2 lcd,32,[$73,$00,$03,$11,$ff,$ff,"DOOR is OPENED",$00]
     ;  return    
    '----------------- [ LOGO Routine ] ------------------------------
    
    Logo_png:
    serout2 lcd,32,[$40, $49, $00, $00, $80, $80, $10, $00, $00, $00]
    pause 3000
    serout2 lcd,32,[$59,$03,$00]
    pause 200
    return         
    '-------------------- [ CLEAR ] ----------------------------------
    Clearlcd:
    serout2 lcd,32,[$45]
    pause 500
    goto logo
    
    '---[TMR1 - interrupt handler]--------------------------------------------------
    ToggleLED1:
    TOGGLE led
    @ INT_RETURN
    and the code for the PIC16F84A

    Code:
     '****************************************************************
    '*  Name    : CodeLock.bas                                      *
    '*  Author  : xxxxxx                                            *
    '*  Date    : xxxxxxxxxx                                        *
    '*  Version : 1.0                                               *
    '*  Notes   : Programable Code Lock with the PIC-16F84          *
    '****************************************************************
    ; Change the code from 1234 by typing the code 1234 then * 1961#1961#   
    
    Include "MODEDEFS.BAS"
    '**************************************************
    RL1_ON_time con 1000 * 5  'sec. Relay ON time
    '**************************************************
    
    TrisA = 0  ' PORTA, all outputs
    PortA = 16 ' turn off Buzer
    OPTION_REG.7 = 0   ' PORTB Pullups.
    TrisB = %11110000  ' PORTB.0-3 outputs, 4-7 inputs  
    PortB = 0
     
    LD1 var PortA.2
    RL1 var PortA.3
    BUZ var portA.4
    
    cnt var byte
    
    key  var byte
    col  var byte
    row  var byte
    keycnt var byte
    pwOK var bit
    
    keybuf var byte[15]
    pwbuf var byte[4]
    
    EEPROM 0,[1,2,3,4] 'Default password 1,2,3,4 programmed at EEprom location 0..3
    Read 0, pwbuf[0]   'Copy password from EEprom address 0..3 in to pwbuf[0..3]
    Read 1, pwbuf[1]
    Read 2, pwbuf[2]
    Read 3, pwbuf[3]
    
    pwOK = 0
    keycnt = 0
    
    Main:
        high ld1
        pause 200
        gosub Chk_KEYPAD
        pause 100
       
    goto Main
    
    Chk_KEYPAD:
       for row = 0 to 3 
          PORTB = (dcd row) ^ $f    
          pause 1
          col = PORTB >> 4
          if (col <> $f) then  'key pressed 
             key = (row * 3) + (ncd (col ^ $f))
             gosub Got_KEY
             key = 255
          endif
       next 
    return    
    
    Beep:
       low ld1
       low buz 
       pause 40
       high buz
    return
    
    Got_KEY:
       gosub Beep
       while (PORTB >> 4) <> $f  
          pause 1
       wend
       if key = 11 then key = 0
       keybuf[keycnt] = key
       gosub Chk_keycnt
    return
    
    Chk_PwOK: 
       PwOK = 0
       if (keybuf[0] = pwbuf[0]) and (keybuf[1] = pwbuf[1]) and (keybuf[2] = pwbuf[2]) and (keybuf[3] = pwbuf[3]) then pwok = 1
    return 
    
    Chk_NewPwOK: 
       PwOK = 0
       if (keybuf[5] = keybuf[10]) and (keybuf[6] = keybuf[11]) and (keybuf[7] = keybuf[12]) and (keybuf[8] = keybuf[13]) then pwok = 1
    return 
    
    Pw_Change:   
       pwbuf[0] =  keybuf[5]
       pwbuf[1] =  keybuf[6]
       pwbuf[2] =  keybuf[7]
       pwbuf[3] =  keybuf[8]
       Write 0, pwbuf[0] 'Store new password to EEprom location 0..3
       Write 1, pwbuf[1]
       Write 2, pwbuf[2]
       Write 3, pwbuf[3]
    return
    
    Chk_keycnt:    
       select case keycnt
          case 4
             gosub Chk_PwOK
             if pwOK then 
                if keybuf[keycnt] = 12 then Access_OK
                if keybuf[keycnt] <> 10 then Clr_keybuf
                gosub Beep
             else
                goto Clr_keybuf
             endif
          case 9
             if keybuf[keycnt] <> 12 then Clr_keybuf
             gosub Beep
          case 14
             if keybuf[keycnt] <> 12 then Clr_keybuf
             gosub Beep
             gosub Chk_NewPwOK
             if pwOK then 
                gosub Beep
                gosub Pw_Change
                gosub Beep
                goto Clr_keybuf
             else
                goto Clr_keybuf
             endif
          case else
             if keybuf[keycnt] = 12 then Clr_keybuf
       end select
       keycnt = keycnt + 1    
    return
    
    Access_OK:
       High RL1
       pause RL1_ON_time
       low RL1
    
    Clr_keybuf:
       for cnt = 0 to 14 
          keybuf[cnt] = cnt 
       next
       keycnt = 0 
    goto Main
    
    end

  12. #12
    Join Date
    Oct 2010
    Posts
    413


    Did you find this post helpful? Yes | No

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

    Tomorrow afternoon the video of what the circuit and the code are all about.

  13. #13
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,132


    Did you find this post helpful? Yes | No

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

    Welcome back Leonardo!

    After this long time, your uLCD I guess is ... obsolete now!

    Ioannis

Similar Threads

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

Members who have read this thread : 0

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