Re: How to compare strings/array? RFID Project
Going by the datasheet of the serial GLCD, it is obvious that the code in the AtmelAVR is pretty limited in capabilities. It can do text, pixels, lines, boxes, circles and not much else.
If you want to do pictures, then look into the COLOR LCD. It is a far more capable product that can even do full motion video (in color) as shown in the video. I have one and would highly recommend it. Full info here http://www.4dsystems.com.au/prod.php?id=114
In fact, since I no longer have a need for it, I may consider running a contest to give it away. :p:p
Re: How to compare strings/array? RFID Project
thanks i will look for an LCD that is capable for my needs.
Re: How to compare strings/array? RFID Project
Quote:
In fact, since I no longer have a need for it, I may consider running a contest to give it away.
Can I compete? or is there a limit?
Re: How to compare strings/array? RFID Project
Quote:
Originally Posted by
astanapane
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.
Re: How to compare strings/array? RFID Project
Publications of the source code of the forum. Very nice project. I'd like to. Thanks
1 Attachment(s)
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.
Attachment 8389
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.
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
Re: How to compare strings/array? RFID Project
Tomorrow afternoon the video of what the circuit and the code are all about.
Re: How to compare strings/array? RFID Project
Welcome back Leonardo!
After this long time, your uLCD I guess is ... obsolete now!
Ioannis
Re: How to compare strings/array? RFID Project
Hi Ioanni, the ulcd is not obsolete but upgraded as for as i checked with a newer version. I think the only difference is the change of the pins position. Instead of the pins are place in one line now they are in 2 lines
Re: How to compare strings/array? RFID Project
Not very good quality of video and explanation but hope you can understand.
Im not a programmer so, it is the best i could up to now.
Next step is to add a RFID KEY MASTER in order to record more RFID tags in to the epprom without having to reprogram the chip.
http://www.youtube.com/watch?v=o0cPDSc_G_Q
Re: How to compare strings/array? RFID Project
Dear all,
the project for my home up to now works OK!.
Here is also a 3D printed case i have designed in order to place nice and clean all the components and electronics.
http://i67.tinypic.com/aujhh5.jpg
Re: How to compare strings/array? RFID Project
Dear all,
i have a small problem with my code and circuit.
After 3 or 4 tries, maybe less maybe after 2 or 3 minutes.....(it is strange) when i pass the RFID from the reader, the first circuit, works perfect, but the second circuit, looks like does not listen to any command from the keypad.
It looks like that it gets power from the first circuit, but when i try to press any button from the Keypad, does not respond.
here is the code of the circuit that is related to the keypad.
If you notice, i havent add any commands for the fuses....because when i did that i was getting errors
;@ DEVICE pic16F84A, HS_OSC, WDT_OFF, PWRT_ON, PROTECT_OFF --> this is not working.
;@ __config _HS_OSC & _WDT_OFF & _PWRTE_ON & _CP_OFF --> this was passing the first error the counldnt find the PIC16F84A but i was getting an error (2007)
The problem is: If i load the code without fuses, the program and circuit works fine on the test board.
When i transfer it to the PCB after 2-3 minutes when i try to pass the TAG from the reader, the Keypad looks like that is not responding.
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 1
gosub Chk_KEYPAD
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
Quick reply to this message Reply Reply With Quote Reply With Quote Multi-Quote This Message
Re: How to compare strings/array? RFID Project
Ok,
first thing first. I will edit the ,inc file and commend it in order to avoid the error 2007
overwritting previous address contents (2007)
then i will see if that works. I will post results tomorrow afternoon.
Re: How to compare strings/array? RFID Project
Which compiler you use now?
Ioannis
Re: How to compare strings/array? RFID Project
an old one, as far as i remember is the 2.6b
Re: How to compare strings/array? RFID Project
Then yes, you should edit the *.inc file first the way you stated.
Ioannis
Re: How to compare strings/array? RFID Project
Thanks Ioanni.
In case of the newer version, should i have to edit again the .inc files?
Let me first fix the code and then will discuss further.
Re: How to compare strings/array? RFID Project
PBP 3 does not need messing with the inc files. But has different fuses setup. More easy.
Ioannis
Re: How to compare strings/array? RFID Project
it took me a while to find the proper configuration of the fuses, but code works fine.
At the moment it works on a TEST BOARD, but not on the pcb board. Maybe i have done a mistake on the drawing and i create an overflow or a bad EMF that causes a problem to the resonator.
What im thinking of is to use the internal OSC of the PIC16F84A, 4Mhz, instead of the external 4Mhz resonator. In that way i will also eliminate a component and i will check whether that was the problem.
1 Attachment(s)
Re: How to compare strings/array? RFID Project
Finally i did a second circuit, which both of the PICs are not related to once each other, but they are a separate operational circuits. Each of then drives the same relay.
As i have told you this a circuits that will be outside on a main door in a small Village, so people that would like to come in, they need to know either the PASSCODE on the Keypad, or to have with them an RFID key.
After a small discussion we had, old people didnt like to carry an RFID key, so they requested if it is possible to have only the keypad.
On the other side, the younger of the family, liked the idea of the rfid, which the only downside it is to take care not to loose it. Ofcourse both will know the main password on the keypad so, for those will have an rfid key, if once does not work, will have the option to use the keypad to access the door.
To be honest, in nowadays, especially in the village, you do not need a super extreme security system. In addition to that, the simplest the better!!!
I understand that to carry an RFID key is the same as to have the real key to open the door. In my next experiment i will try to include a fingerprint sensor, but im waiting to see a good one, because at the moment none is so reliable.
Attachment 8390