Digital Code Lock With 3310 LCD
i want make digital code lock with 3310 lcd
i am triad change the code for 3310 lcd
but only display on 3310 lcd "Enter lock code" and no any keypad
number display and 2x16 lcd work fine i am send all file with proteus file
plz cheek the code and help me
#include "lcd_1.h"
#include "Nokia3310Driver/lcd.h"
#include "keypad.h"
#include "lock.h"
#include "delay.h"
extern unsigned char input[10], userlock[5];
extern unsigned char code defaultulock[5],masterlock[10];
bit newlock=FALSE;
unsigned char retrycount=3;
void main(){
unsigned char status,i=0;
bit lockstatus;
lcd_init();
initlcd();
keypad_init();
while(1){
lcd_cmd(LCD_CLS);
lcd_str("Enter lock code");
clearram ;
cursorxy(3,1);
putstr("Enterlock code");
lcd_cmd(0xC0);
lcd_data(LOCK);
lcd_data(':');
status = getinput(5);
if(check(input,"12345",5)){
setulock();
goto done;
}
if(status == TRUE){
if(newlock)
lockstatus = check(input,userlock,5);
else
lockstatus = check(input,defaultulock,5);
if(lockstatus){
retrycount = 3;
lockpin = 0;
lcd_cmd(LCD_CLS);
lcd_data(OK);
lcd_str(" Lock is");
clearram ;
cursorxy(5,1);
putstr("Lock is deactivated");
lcd_cmd(0xC0);
lcd_str("deactivated!");
delayms(250);
delayms(250);
delayms(250);
delayms(250);
lcd_cmd(LCD_CLS);
lcd_str("Press '#' key to");
clearram ;
cursorxy(5,1);
putstr("Press '#' key to");
lcd_cmd(0xC0);
lcd_str("lock again!");
cursorxy(1,1);
putstr("lock again!");
while(getkey()!=12);
lockpin = 1;
lcd_cmd(LCD_CLS);
lcd_data(OK);
lcd_str("Lock is active!");
clearram ;
cursorxy(5,1);
putstr("Lock is active!");
}
else{
retrycount--;
lcd_cmd(LCD_CLS);
lcd_data(EX);
lcd_str(" Wrong Code!");
clearram ;
cursorxy(5,1);
putstr("Wrong Code!");
lcd_cmd(0xC0);
lcd_str("Tries left = ");
cursorxy(5,1);
putstr("Tries left =");
lcd_data('0'+retrycount);
delayms(250);
delayms(250);
delayms(250);
delayms(250);
if(retrycount==0){
blocked:
lcd_cmd(LCD_CLS);
lcd_data(EX);
lcd_str("BLOCKED");
clearram ;
cursorxy(5,1);
putstr("BLOCKED =");
lcd_data(EX);
lcd_cmd(0xC0);
lcd_data(LOCK);
lcd_data(':');
status = getinput(10);
if(check(input,masterlock,10)){
retrycount=3;
lcd_cmd(LCD_CLS);
lcd_data(EX);
lcd_str("UNBLOCKED");
clearram ;
cursorxy(5,1);
putstr("UNBLOCKED");
lcd_data(EX);
delayms(250);
delayms(250);
delayms(250);
delayms(250);
}
else{
lcd_cmd(LCD_CLS);
lcd_data(EX);
lcd_str("WRONG CODE");
clearram ;
cursorxy(5,1);
putstr("WRONG CODE");
lcd_data(EX);
delayms(250);
delayms(250);
delayms(250);
delayms(250);
goto blocked;
}
}
}
}
done:;
}
}
i edit the code and changes cursor position a little bit
u were missing these lines that's why u were not able to display characters
putchar(key); and putchar('0'+retrycount); // no of tries remainning
i am changes in code
putchar(key);
putchar('0'+retrycount);
but no display characters
i think more error in code plz more help me
thanks
i run the above code in proteus
2x16 lcd work fine 3310 lcd wark fine but
keypad characters display only 2x16 LCD not on 3310 LCD
plz cheek again
thanks
this time i attaching a folder model
in model folder there r 2 folder library and models
in library folder there r 2 files
OTTO.IDX and OTTO.LIB
copy these files and paste at the adress
C:\Program Files\Labcenter Electronics\Proteus 7 Professional\LIBRARY
in model folder there is 1 file named as pcd_8544.dll copy that and paste it at
C:\Program Files\Labcenter Electronics\Proteus 7 Professional\MODELS
after that restart ur computer and try this coding at my pc it is working i am using keil uv3 and uv2 i test it on both
i am using proteus 7.6 sp0
if u get problem again then may b there is a problem in ur setups then download from here which i am using
1) http://ifile.it/1aov2lf
2) http://ifile.it/1aov2lf/Proteus%207.6%20sp0.rar
for keil
1) http://ifile.it/rtkzpg4
2) http://ifile.it/rtkzpg4/keil.rar
[ Edited Tue Sep 28 2010, 12:57 am ]
i am change the library and models files
new 3310 lcd work fine
where define x y cursor position for characters display in code