Discussion in "Project Addition or Changes" started by    tahirmaqsood    Sep 26, 2010.
Sun Sep 26 2010, 10:55 pm
#1
Dear sir
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:;
}
}


Attachment
Mon Sep 27 2010, 02:25 pm
#2
hi tahirmaqsood
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

Mon Sep 27 2010, 09:31 pm
#3
Thanks Majoka for Reply and help me
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
Mon Sep 27 2010, 09:36 pm
#4
i upload the complete working code with proteus digram as code_lock.rar in my above post download that if get problem then tell
Mon Sep 27 2010, 11:53 pm
#5
Majoka again 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
Tue Sep 28 2010, 12:57 am
#6
dear i again check it is working fine
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 ]
Tue Sep 28 2010, 12:59 am
#7
here is the code
 romel_emperado like this.
Tue Sep 28 2010, 01:17 am
#8
 tahirmaqsood like this.
Tue Sep 28 2010, 05:46 pm
#9
Dear Majoka very thanks
i am change the library and models files
new 3310 lcd work fine
Tue Sep 28 2010, 06:58 pm
#10
Dear Majoka
where define x y cursor position for characters display in code

Get Social

Information

Powered by e107 Forum System

Downloads

Comments

Bobbyerilar
Thu Mar 28 2024, 08:08 am
pb58
Thu Mar 28 2024, 05:54 am
Clarazkafup
Thu Mar 28 2024, 02:24 am
Walterkic
Thu Mar 28 2024, 01:19 am
Davidusawn
Wed Mar 27 2024, 08:30 pm
Richardsop
Tue Mar 26 2024, 10:33 pm
Stevencog
Tue Mar 26 2024, 04:26 pm
Bernardwarge
Tue Mar 26 2024, 11:15 am