12864密码锁
扫描二维码
随时随地手机看文章
这个程序真的花了我好长的时间调试,终于写好了,大家可以看看我的密码锁,有点花哨呕!!
下面是密码锁简约版本:
main.c
#include
#include"12864.h"
#include"keyscan.h"
#include"baojin.h"
uchar mima[5]={1,2,3,4,5};
main()
{
uchar length,i,flag,inputtimes,flagkaimeng;//tempê??ü??μ?áùê±±?á?
uchar itouch,flaggaimima;//ó?à′???????yê?è?μ??ü??μ???êy
uchar mimatemp[5];
init_12864();
lcd_pos(0,2);
write_string("welcom!!");
delay1ms(2);
lcd_pos(1,0);
write_string("PSW:");
write_cmd(0x0f);//′ò?a1a±ê
f3:
while(1)
{
i=0;
if(inputtimes>=1)//ê?è?′í?óoóμ??¢μ÷?êìa
{
lcd_pos(1,2);
write_string(" ");
lcd_pos(1,2);
}
while(1)
{
f:
num=keyscan();
if(num!=0xff)
{
if(num==15)//?¨ò??aè·è?
break;
if(num==16)//?a????·¨?éò?êμ???à2?í???
{
i--;//±íê??°??ê?è?μ?êy?Y?TD§
lcd_pos(1,2);
write_string(" ");
lcd_pos(1,2);
if(i==-1)//±ü?a?à′?°′???ì3ébug
i=0;
for(itouch=0;itouch
write_string("*");
goto f;
}
if(num==14)//±íê?òaDT???ü??
{
flaggaimima = 1;
break;
}
if(num!=16)//16?¨ò??a??3μ£???3y?°??ò???êy?Y
{
mimatemp[i]=num;
i++;
length = i;
write_string("*");
//write_date(num+0x30);
}
}
}
if(flaggaimima==1)
{
flaggaimima = 0;
while(1)
{
f1:
num=keyscan();
if(num!=0xff)
{
if(num==15)//?¨ò??aè·è?±íê?DT???ü???áê?
{
lcd_pos(1,2);
write_string(" ");
lcd_pos(1,2);
break;
}
if(num==16)//?a????·¨?éò?êμ???à2?í???
{
i--;//±íê??°??ê?è?μ?êy?Y?TD§
lcd_pos(1,2);
write_string(" ");
lcd_pos(1,2);
if(i==-1)//±ü?a?à′?°′???ì3ébug
i=0;
for(itouch=0;itouch
write_string("*");
goto f1;
}