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 -


Sunday, November 29, 2009

Taxi Driver Qualifications Raleigh

16F628A LCD LDR

Here's a simple tutorial on creating new characters or symbols on alphanumeric displays.
These LCDs usually have a driver or HD44780 compatible and are composed of an array of 5 horizontal pixels by 8 vertical in nature. In its report CGRAM can store up to 8 new characters.

Application of symbols is used to create animations or status indicators, as might be the triangle to Play, Stop-square, battery icon, etc ...
pictures
This matrix will help us calculate the bytes required to create a new character or symbol.

colored black squares are added horizontally to form a line,
and each line is added independently.
Now we only need to send information to the microcontroller as follows:

LCDOUT 254, 64, 30, 18, 18, 28, 20, 18, 17, 0

LCDOUT Where is the instruction that controls the LCD. Sending
254 or $ FE the LCD will indicate who is to receive a command. 64
command instructs the LCD is the first character CGRAM memory . Data
30, 18, 18, 28, 20, 18, 17, 0 Bytes represent the new character.

Once done so, the new character is already stored in memory LCD CGRAM, but not displayed until you use it as follows:

LCDOUT 0

LCDOUT Where is the instruction that controls the LCD. And
0 is the first character CGRAM memory we previously recorded in the command 64.

To add more characters to the CGRAM memory have to add 8 to command, in this case is 64 + 8 = 72 and so on.
In this example we can see the 8 command and Bytes calculated with the new characters.

LCDOUT 254, 64 , 4,10,10,4,4,6,4,6 ; Wash POSITION "0"
LCDOUT 254, 72 , 4,14,31,21,31,31,27,27
, House position 1
LCDOUT 254, 80 , 4,14,10,10,10,10,10,14 ; Battery POSITION "2"
LCDOUT 254, 88 , 0,10,31,31,31,14,4,0 ; Heart POSITION "3"
LCDOUT 254, 96, 10.21, 0,10,0,21,17,14 ; Smile POSITION "4"
LCDOUT 254, 104 , 0,0,0, 4,2,31,2,4 Right Arrow POSITION "5 "
LCDOUT 254, 112 , 4,14,14,14,14,14,21,21
; Rocket POSITION" 6 "
LCDOUT 254, 120 , 0,14,21,21,23,17,14,0 ; clock position "7"

Once done this, to see them just need to type the location where they were recorded.

LCDOUT 0, 1, 2, 3, 4, 5, 6, 7

LCDOUT Where is the instruction that controls the LCD. And
0 corresponds to the character stored in the command 64.
The 1 corresponds to the character stored in the command 72 and so on.
For this tutorial we used a PIC 16F628A microcontroller and Powertip1602-G lcd alphanumeric 2 rows of 16 characters each. Configuration
pins 4bits LCD will use the predefined by the compiler pbp
is the ports A1, A2, A3, A4 will be the data and are connected to the LCD to pin D4, D5, D6, D7. The port pin A4 corresponds to R / S of the LCD and the port B3 to pin E. As in the following figure:



is written in Basic language, specifically the PicBasic Pro 2.46C (PBP). PAUSE

500 ; Time to start the LCD

LCDOUT 254.64, 4, 10, 10 , 4, 4, 6, 4, 6 ; position 0 (key)
LCDOUT 254.72, 4, 14, 31, 21, 31, 31, 27, 27
; position 1 (home)
LCDOUT 254.80, 0, 14, 27, 31, 3, 31, 14, 0 ; position 2 (drums)
LCDOUT 254.88, 0, 10, 31, 31, 31, 14, 4, 0 ; position 3 (heart) PAUSE 200

LCDOUT $ FE, 1
, clear screen
LCDOUT "infotronikblog " ; Print screen characters
$ LCDOUT FE, $ C0,
" " , 0,1,2,3 ; recorded on the LCD CGRAM
END


Table with normal characters on the LCD.