Friday, January 8, 2010

Gay Glory Hole/fredericton Nb

Teclaco LCD + 3x4 with special characters

Well here is a video of an electronic lock made with pic 16F628A. Later I will put the scheme and the code in pbp



This is the scheme in Proteus:


Instead of putting a relay I have a LED but it's the same effect by placing a transistor can handle larger loads.

And that's the code in PBP:

; Electronica Electronic lock with 3x4 keypad, LCD 16x2,
, and 4-digit password that is recorded even when the Pic
; longer have power.
, use NSP 16F628A micro quartz crystal prescidiendo
, external and internal clock using
@ DEVICE PIC16F628A, WDT_OFF
@ DEVICE PIC16F628A, PWRT_ON
@ DEVICE PIC16F628A, BOD_ON
@ DEVICE PIC16F628A, PROTECT_OFF @
DEVICE PIC16F628A, CPD_OFF
@ DEVICE PIC16F628A, MCLR_OFF
@ DEVICE PIC16F628A, INTRC_OSC_NOCLKOUT
@ DEVICE PIC16F628A, LVP_OFF \u200b\u200b

PORTA DEFINE LCD_DREG ; LCD Data port DEFINE
LCD_DBIT 0 , LCD data starting in BIT 0 or 4 "these accrued to be consecutive" defined LCD_EREG
PORTB; change portb.3 Enable the DEFINE
LCD_EBIT 7; the portb.7
LCD_RSREG PORTA DEFINE DEFINE
LCD_RSBIT 4

; definition of variables

a key word var var var byte word

n1 n2 n3
var var byte byte Var n4
eprom1 var byte byte

, defining ports
THE PORTB.0 var; Line A
var portb.1 LB; Line B
var portb.2 LC; Line LD C
PORTB var. 3 ; Line D
var portb.4 Funo, Column 1
FDoS var portb.5 , Column 2
Ftres var portb.6 , Column 3
var porta.6 relay, relay

n1 = "2" ; assigns values \u200b\u200bto variables
n2 = "5" , the value is equivalent asccII
n3 = "8" , this will be the default combination
n4 = "0" , remember to change it!


eprom1 = "0"

PAUSE 100; Home
program read 0, eprom1
eprom1 = 255 Then if gravar_clave
welcome

gravar_clave goto:
WRITE 0, WRITE 1
n1, n2
Writer 2, WRITE
3 n3, n4

LCDOUT $ FE, 1, $ FE, 2, "ENGRAVED KEY"
PAUSE 1500 GOTO


Welcome Welcome:
pause 500; Welcome Message
LCDOUT $ FE, 1, $ FE, 2, "Infotronikblog"
LCDOUT $ FE, $ C0, "Presents:"

start: pause 500


LOW LOW LA LB LC

HIGH LOW lD; activate the line of Asterisk
Funo IF key = 0 then goto 500
pause; LEE THE KEY TO SEE IF "*"
, IF NOT MESSAGE CONTINUES TO SHOW
goto start


keyboard: ; Label keyboard


low if the
Funo
= 0 then a = 0 then if FDoS two
ftres = 0 then if three high

the low
if
lb Funo = 0 then four
if FDoS = 0 then five
if ftres = 0 then six

low

lb lc high
if Funo = 0 then seven
if FDoS = 0 then eight
if ftres = 0 then nine

high low
lc ld
Funo = 0 then if
asterisk if FDoS = 0 then zero if ftres
numeral
= 0 then pause 10 high
ld
goto

keyboard asterisk:
key = "*" return


seven:
key = "7"


return four:
key = "4" return


one:
key = "1" return


two:
key = "2 " return


five:
key = "5"


return eight:
key = "8"


return zero
key = "0"
return

three:
key = "3" return


Six:
key = "6"


return nine:
key = "9" return


numeral:
key = "#"


return key
LCDOUT $ FE, 1, $ FE, 2, "Enter Password"
keyboard pause 1000 gosub

SWAP key, n1
LCDOUT $ FE, $ C5, "*"
pause 500 gosub

SWAP key keyboard, n2
LCDOUT $ FE, $ C6, "*"
pause 500 gosub
SWAP
keyboard key n3
LCDOUT $ FE, $ C7, "*"
pause 500 gosub

SWAP key keyboard, n4
LCDOUT $ FE, $ C8, "*" pause 500


READ 0, IF
EPROM1 eprom1 Then n1 = miro_dos

Error:
LCDOUT $ FE, 1, $ FE, 2, "Password Incorrect"
welcome pause 500 goto


miro_dos:
READ 1, IF
eprom1 eprom1 = n2 Then goto
miro_tres error

miro_tres:
READ 2, eprom1
eprom1 IF n3 = miro_cuatro Then goto error


miro_cuatro:
READ 3, eprom1
eprom1 = n4 IF THEN GOTO menu goto error




menu:
LCDOUT $ FE, 1, "Choose a"
LCDOUT $ FE, $ C0, "Option" pause 1500


LCDOUT $ FE, 1, "1 Open Door" pause 300

LCDOUT $ FE, $ C0 , "2 Change Password" gosub
IF
keyboard key = "1" THEN goto open
if key = "2" then goto nueva_clave
if key! = "1" and key! = "2" then LCDOUT $ FE , 1, $ FE, 2, "WRONG KEY" ; If you press a
LCDOUT $ FE, 1, $ FE, 2, "WRONG KEY" , which is neither 1 or 2 shows wrong key
pause goto menu

700
open:
high relay
LCDOUT $ FE, 1, $ FE, 2, "Welcome"

low pause 3000 goto relay
welcome

nueva_clave:
LCDOUT $ FE, 1, $ FE, 2, " Enter your new "
LCDOUT $ FE, $ C0, " Password: "
pause 500 gosub
SWAP
keyboard key, n1
LCDOUT $ FE, $ C8, " * "
pause 500 gosub
SWAP
keyboard key, n2
LCDOUT $ FE, $ C9, "*"
pause 500 gosub

SWAP key keyboard, n3
LCDOUT $ FE, $ C9 +1, "*"
pause 500 gosub
SWAP
keyboard key, n4
LCDOUT $ FE, $ C9 +2, "*"
pause 500 goto gravar_clave



;------------------ --------------- -------------------------------- END OF CODE -


0 comments:

Post a Comment