RFID Voter please help!


Results 1 to 9 of 9

Threaded View

  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.

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