Hi Joe,
thank you, i will try to fix the code before i get the componets, but it a bit difficult without them.
I havent recieve the ID-12 modules yet. So i expect them next week possible on Wednesday.
Hi Joe,
thank you, i will try to fix the code before i get the componets, but it a bit difficult without them.
I havent recieve the ID-12 modules yet. So i expect them next week possible on Wednesday.
The attached file shown what i need to do with the ID-12 and the pic16f628a.
I will seperate those in two circuits.
The first circuit will read and identify the RFID cards and the second circuits will be based on the 3x4 keypad.
Once you pass the rfid card from the ID-12 the circuit will check if the card is valid or not.
If it is valid then will proceed and display your name. If not then you will need to go back and check card again.
Once you are accepted from the system then you only have 5 seconds to open the door. You will need to type your 4 digit code in order to open the door.
Last edited by astanapane; - 1st April 2011 at 13:59.
hello all again,
i just received the RFID module 12 from sparkfun.
I test the serial usb device with Secure CRT and works fine.
Now i'm building the circuit and the code.
As i told you i would like to make a code that can display the name of the holder according to the ID of the RFID tag.
I havent connect the ID-12 yet because the dimensions of the pins are not much to the standard ones. I will make a pcb this afternoon and then i will try to make a schematic.
Now i have attached the code i have done so far, copied most of it from the people here in forum.
i would like to know if i can use the command serin2 on the pin portb.1 on the pic16f628a in order to read the data.Code:CMCON = 7 DEFINE OSC 4 'Set oscillator in MHz DEFINE LCD_DREG PORTB 'define port to LCD DEFINE LCD_DBIT 4 'RB4 RB5 RB6 RB7 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 'clear Lcdout $FE,1,4 ' -----[ Variables ]------------------------------------------------------- buf VAR Byte(12)' 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 "450052B6BC1A" Tag2 DATA "450052F2EB0A" ' -----[ 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 ]---------------------------------------------------- Main: LOW portb.1 ' activate the reader SERIN2 portb.1, 396, [WAIT($0A)] ' STR buf\12] ' wait for hdr + ID HIGH portb.1 ' deactivate reader Check_List: FOR tagNum = 1 to 2 ' scan through known tags FOR idx = 0 TO 11 ' scan bytes in tag READ (((tagNum-1) * 12) + 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 porta.3, 1000 */ $100, 115 */ $100 ' groan PAUSE 1000 GOTO Main Tag_Found: IF tagNum = 1 then displayName1 IF tagNum = 2 then displayName2 GOTO Main displayName1: lcdout $FE, 1,"NAME for tag 1" 'assuming your display is on porta.0 @ 9600 baud pause 500 'Pause ,5 sec then clear display goto open_door displayName2: lcdout $FE, 1,"Name for tag 2" 'assuming your display is on porta.0 @ 9600 baud pause 500 'Pause ,5 sec then clear display goto open_door open_door: HIGH portb.2 ' remove latch High portb.3 ' Light LED FREQOUT porta.2, 2000 */ $100, 880 */$100 ' beep LOW portb.2 ' restore latch Low portb.3 ' LED OFF GOTO Main
I know that the code may have a lot of mistakes but as i told you i'm not a programmer and i try to make it as good as i can.
I only need a little bit of your help in certain points that you sure know better than me.
thank you all for your help in advance.
Last edited by astanapane; - 9th April 2011 at 15:20.
hi all,
i did some small changes and read data on 9600.
But i cannot make it work yet.
When i pass the TAG from the reader does not display the name.
It displays 'Bad Dag' only. And the tag is the valid one i pass from the reader.
Could you please help me with my program?
I have tags from Sparkfun that i believe are with 12 digits so i think we need to make some changes there.
here is the code:
Code:@ DEVICE PIC16F628A CMCON = 7 DEFINE OSC 4 'Set oscillator in MHz 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 ' Ενεργοποίησε το LCD Lcdout $FE,1,4 lcdout $FE, 1," Leonardo" pause 500 ' -----[ Variables ]------------------------------------------------------- buf VAR Byte(12)' 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 "450052B6BC1D" Tag2 DATA "450052F2EB0E" ' -----[ 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 ]---------------------------------------------------- Main: high portb.3 low portb.1 ' activate the reader SERIN2 portb.1, 84, [WAIT($0A)] ' STR buf\12] ' wait for hdr + ID high portb.1 ' deactivate reader pause 500 Check_List: FOR tagNum = 1 to 2 ' scan through known tags FOR idx = 0 TO 11 ' scan bytes in tag READ (((tagNum-1) * 12) + 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 high porta.3 pause 200 low porta.3 pause 200 lcdout $FE, 1," bad tag" pause 500 FREQOUT porta.3, 1000 */ $100, 115 */ $100 ' groan PAUSE 1000 lcdout $FE,1 GOTO Main Tag_Found: IF tagNum = 1 then displayName1 IF tagNum = 2 then displayName2 GOTO Main displayName1: lcdout $FE, 1,"ASTANAPANE" 'assuming your display is on porta.0 @ 9600 baud pause 500 'Pause ,5 sec then clear display goto open_door displayName2: lcdout $FE, 1,"TIGRI" 'assuming your display is on porta.0 @ 9600 baud pause 500 'Pause ,5 sec then clear display goto open_door open_door: HIGH portb.2 ' remove latch High portb.3 ' Light LED FREQOUT portb.3, 2000 */ $100, 880 */$100 ' beep LOW portb.2 ' restore latch Low portb.3 ' LED OFF GOTO Main
hi all again,
i try to see what the problem is.
I think there might be a problem on storing data to EEPROM of the pic16f628a...
and there also be a problem somewhere on the code...
when i try to pass the card from the reader it light the led of the reader but nothing happens to my LCD.Code:Main: high portb.3 low portb.1 ' activate the reader SERIN2 portb.1, 84, [WAIT($0A)] ' STR buf\12] ' wait for hdr + ID high portb.1 ' deactivate reader pause 500 Check_List: FOR tagNum = 1 to 2 ' scan through known tags FOR idx = 0 TO 11 ' scan bytes in tag READ (((tagNum-1) * 12) + 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!
then i pass second time the card from the reader the led on the porta.3 light up and i get on my lcd the Error tag.
I dont understand what is happening on the first time that i pass the card. It doesnt do anything.
Why when i pass it two times i have bad tag on the display.
On other thing is that i cannot make it work to show me the name on the display on the right cards.
If you have any solutions please help me.
regards
Just countin beans here:
I think should readCode:buf VAR Byte(12)' RFID bytes buffer
I am looking for other issuesCode:buf VAR Byte[12]' RFID bytes buffer
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.
Thank you Joe,
i will make the change in the afternoon, then i will check and let you know.
Your help is much apreaciated.
Best Regards,
Bookmarks