RFID Voter please help!


Closed Thread
Results 1 to 9 of 9
  1. #1
    Join Date
    Dec 2014
    Posts
    4

    Default RFID Voter please help!

    This is quite urgent,
    i have a project that i will be defending on Friday (5th December ), I am new to programming and have really done some work coding in PICBasic.

    I have to code a PIC18F4550 micro controller for ELECTRONIC VOTING SYSTEM using RFID Identification system, but i need the code to accept four (4) digit verification code before allowing voting to continue but i don't know how to go about it...
    The code can only ID the tags but I cannot take it further than than due to my limited knowledge of PICBasic programming.Ii need the code to request for a four-digit pin that will be assigned to each tag number in order to verify after system ID tags. please I need urgent help as the defense date is so close. below is the code so far.......

    Code:
    '@ DEVICE PIC16F628A  
    INCLUDE "modedefs.bas" 
    CMCON = 7  
    DEFINE OSC 4 'Set oscillator in MHz 
    TRISA=%11100
    TRISB=%00000010
     
    DEFINE LCD_DREG PORTB 'define port to LCD
    DEFINE LCD_DBIT 4 'RB4 RB5 RB6 RB7 to D4 D5 D6 D7 display 
    DEFINE LCD_RSREG PORTA 'RS on porta 
    DEFINE LCD_RSBIT 0 'RS on porta.0 
    DEFINE LCD_EREG PORTA 'Enable on porta 
    DEFINE LCD_EBIT 1 'Numero Enable porta.1 
    DEFINE LCD_BITS 4 '  
    DEFINE LCD_LINES 2 'lines 2  
    PAUSE 200 ' Stop 200ms 
    LCDOUT $FE,1 ' power lcd 
    'Lcdout $FE,1,4 
    lcdout $FE, 1," Copyright 2014" 
    lcdout $FE, $C0,"  ELECTRONIC    " 
    lcdout $FE, $90," VOTING SYSTEM   "
    lcdout $FE, $D0," TECHNOLOGIES   "
    pause 5000 
    lcdout $FE,1 
    ' -----[ 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 
    MEK VAR BYTE 
    IFE VAR BYTE
    ' -----[ EEPROM Data ]-----------------------------------------------------  
    Tag1 DATA "0002864330" 
    Tag2 DATA "450052F2EB" 
    
    ' -----[ Initialization ]-------------------------------------------------- 
    'high portb.1 ' turn off RFID reader portb.1 is the reciever port 
    LOW portb.2 ' lock the door! Low portb.3 ' Turn off LED  
    ' -----[ Program Code ]---------------------------------------------------- 
    MEK=0
    IFE=0
     
    Main: 
    lcdout $FE,1," PLEASE USE YOUR" 
    lcdout $FE, $C0,"  TAG FOR ID  " 
    pause 500 
    high portb.3 
    low portb.1 ' activate the reader 
    pause 500 
    SERIN2 portb.1,84,[WAIT($02),STR buf\10]
    pause 500 
    high portb.1 ' deactivate reader
    
      
    Check_List: 
    FOR tagNum = 1 to 2 ' 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 Tag_Found'Bad_Char ' compare tag to table 
    NEXT 
    'GOTO Tag_Found ' all bytes match! 
     
    Bad_Char: ' try next tag 
    NEXT  
    
    Bad_Tag: 
    tagNum = 0 
    FREQOUT porta.3, 1000 */ $100, 115 */ $100 ' groan 
    lcdout $FE, 1," invalid TAG" 
    lcdout $FE, $C0," try again" 
    pause 1000 
    lcdout $FE,1 
    GOTO Main  
    
    Tag_Found:  
    
    'IF tagNum = 1 then displayName1  
    'IF tagNum = 2 then displayName2 
    lcdout $FE, 1,"WELCOME YOU CAN  "  
    LCDout $FE, $C0,"  NOW VOTE     " 
    pause 4000 'Pause ,5 sec then clear display 
    lcdout $FE, 1,"PRESS A FOR PDP  "  
    LCDout $FE, $C0,"PRESS B FOR ACN  " 
    lcdout $FE, $90,"PRESS C FOR APGA "
    lcdout $FE, $D0,"PRESS D FOR APP  "
    pause 4000 'Pause ,5 sec then clear display  
     
    
    GOSUB VOTE
    
    GOTO Main
    
    VOTE:
    IF PORTA.2=0 THEN CAND1
    PAUSE 10
    IF PORTA.3=0 THEN CAND2
    PAUSE 10
    GOTO VOTE
    
    
    CAND1: 
    IF PORTA.2=0 THEN CAND1
    MEK=MEK+1
    lcdout $FE, 1,"PDP =",#MEK  
    LCDout $FE, $C0," ACCESS GRANTED" 
    pause 4000 
    GOTO  Main
    
    CAND2: 
    IF PORTA.3=0 THEN CAND2
    IFE=IFE+1
    lcdout $FE, 1,"ACN =",#IFE  
    LCDout $FE, $C0," ACCESS GRANDED" 
    pause 4000  
    GOTO  Main
    'displayName2: 
    'lcdout $FE, 1,"  UGOCHUKWU  "  
    'LCDout $FE, $C0," ACCESS GRANDED" 
    'pause 3000 'Pause ,5 sec then clear display 
    'goto open_door
    
    'displayName1: 
    'lcdout $FE, 1,"   EMEKA   "  
    'lcdout $FE, $C0, "ACCESS GRANDED" 
    'pause 3000 'Pause ,5 sec then clear display 
    'goto open_door  
    
    
      
    'open_door: 
    'HIGH portb.2 ' remove latch 
    'pause 500 
    'LOW portb.2 ' restore latch 
    'Low portb.3 ' LED OFF GOTO Main
    goto Main
    End
    please house , I need this, and will appreciate your your assistance
    thank you!
    Last edited by Archangel; - 1st December 2014 at 23:01.

  2. #2
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,154


    Did you find this post helpful? Yes | No

    Default Re: RFID Voter please help!

    Looks like you used code from another PIC but didn't change the settings. You only have CMCOM, are you sure about this?

    I'm not sure about how you use port A for the LCD. Does it work right?

    Robert

  3. #3
    Join Date
    Dec 2014
    Posts
    4


    Did you find this post helpful? Yes | No

    Default Re: RFID Voter please help!

    yes, i was testing code on PIC16F628A mostly for hardware "handshaking" , worked on it, so i think it'll work on the PIC18F4550. i just want the code modified to "ask" for a (4-digit ) pin number for every tag that will be registered. before voting continues

  4. #4
    Join Date
    Dec 2014
    Posts
    4


    Did you find this post helpful? Yes | No

    Default Re: RFID Voter please help!

    ok, can anyone help on how to input value (for comparison) in EEPROM table

  5. #5
    Join Date
    May 2013
    Location
    australia
    Posts
    2,632


    Did you find this post helpful? Yes | No

    Default Re: RFID Voter please help!

    how many rfid tags do you expect to process ,you realise of couse that that chip has only 256 bytes of eprom (ie 25 tags)
    where does the pin value come from and how is linked to the rfid tag?
    and surely once a tag has "voted" it needs to be removed from the active list ?????
    for 25 tags its hardly worth the effort except maybe as an educational exercise

    LABOR RATES
    Normal………………………………$12.50
    If you wait…………………………..$15.00 per hour
    If you watch………………………..$20.00 per hour
    If you help………………………….$30.00 per hour
    If you worked on it first………..$50.00 per hour

    Deposit $1 x 2^(32-days to deadline)

  6. #6
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,154


    Did you find this post helpful? Yes | No

    Default Re: RFID Voter please help!

    Quote Originally Posted by philosofa View Post
    ok, can anyone help on how to input value (for comparison) in EEPROM table
    DATA to store, READ to retrieve.

    Robert

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


    Did you find this post helpful? Yes | No

    Default Re: RFID Voter please help!

    Quote Originally Posted by richard View Post
    . . . and surely once a tag has "voted" it needs to be removed from the active list ?????
    WHAT ? ? ? No Vote for me, and vote often?
    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.

  8. #8
    Join Date
    May 2013
    Location
    australia
    Posts
    2,632


    Did you find this post helpful? Yes | No

    Default Re: RFID Voter please help!

    No Vote for me, and vote often
    the special tag costs extra

  9. #9
    Join Date
    Dec 2014
    Posts
    4


    Did you find this post helpful? Yes | No

    Default Re: RFID Voter please help!

    Quote Originally Posted by richard View Post
    how many rfid tags do you expect to process ,you realise of couse that that chip has only 256 bytes of eprom (ie 25 tags)
    where does the pin value come from and how is linked to the rfid tag?
    and surely once a tag has "voted" it needs to be removed from the active list ?????
    for 25 tags its hardly worth the effort except maybe as an educational exercise
    Just for educational purpose, it's a mini school project.......the pin value is randomly selected for each tag and must not be changeable.

Similar Threads

  1. RFID Issues.... HELP !!!!!
    By andybarrett1 in forum mel PIC BASIC Pro
    Replies: 19
    Last Post: - 11th September 2014, 10:00
  2. RFID example.
    By StevenLim in forum General
    Replies: 2
    Last Post: - 8th February 2011, 09:08
  3. Garbage in from RFID
    By lilimike in forum Serial
    Replies: 6
    Last Post: - 6th December 2009, 14:55
  4. Rfid?
    By toalan in forum Off Topic
    Replies: 0
    Last Post: - 11th February 2005, 23:37
  5. RFid reader
    By paul farrugia in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 14th January 2005, 20:27

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