基于单片机的IC卡门禁系统 - 图文 联系客服

发布时间 : 星期四 文章基于单片机的IC卡门禁系统 - 图文更新完毕开始阅读

{ if(num==13) //+

{HH++;if(HH>23) HH=23;num=255;} if(num==14) //-

{HH--;if(HH<0) HH=0;num=255;} }

/*------------------星期设置程序部分代码部分-------------------*/ if(counter11==4) //设置秒钟XQ { if(num==13)//+

{XQ++;if(XQ>7) XQ=7;num=255;} if(num==14)//-

{XQ--;if(XQ<0) XQ=0;num=255;} }

/*------------------日 设置程序部分代码部分-------------------*/ if(counter11==5) { if(num==13)//+

{DA++;if(HH>31) HH=31;num=255;} if(num==14)//_

{DA--;if(DA<0) DA=0;num=255;} }

/*------------------月份设置程序部分代码部分-------------------*/ if(counter11==6) { if(num==13)//+

{MO++;if(MO>12) MO=12;num=255;} if(num==14)//-

{MO--;if(MO<0) MO=0;num=255;} }

/*------------------年份设置程序部分代码部分-------------------*/ if(counter11==7) { if(num==13)//+

{YE++;if(YE>99) YE=99;num=255;} if(num==14)//-

{YE--;if(YE<0) YE=0;num=255;} } }

uchar countt=0; uchar counter1,x;

uchar table1[5];//存储A C 参数值 基础运算数据 单个最大6位 long A;//A结果 long GG=0;

31

char flag=0;

char N,Y,R,HH,MM,SS; int RR=0; int BB;

/**************************** 延时子程序 ************************/ void Delay11(void) {

uchar i,j,k;

for(i=500;i>0;i--) for(j=50;j>0;j--)

for(k=5;k>0;k--) ; }

void shizhong1() { RR=0; while(1) { num=keyscan(); lcd_goto_xy(0,0); lcd_puts(\ lcd_goto_xy(7,1); lcd_number(BB/10); lcd_number(BB); flag=0; if(BB>30)

{Beep_key();BB=RR=0;init_lcd();table1[0]=table1[1]=table1[2]=table1[3]=table1[4]=table1[5]=0;LED=1;A=x=counter1=0;num=255;break;} if(num==15)

{Beep_key();init_lcd();MM=HH=SS=0;table1[0]=table1[1]=table1[2]=table1[3]=table1[4]=table1[5]=0;LED=1;A=x=counter1=0;num=255;break;} RR++; if(RR==1000) { RR=0; BB++; } } }

void change_word() {

if(num==11)

32

{

num=255;init_lcd();

table1[0]=table1[1]=table1[2]=table1[3]=table1[4]=table1[5]=0;A=GG=x=counter1=0; Beep_key();

lcd_goto_xy(0,0);

lcd_puts(\ GG=0; beep=1; while(1)

{num=keyscan();//反复扫描4*4键盘获得按键参数 if((num<10)&&(x<6)) //A { lcd_goto_xy(5+x,1); Beep_key(); lcd_number(num); table1[counter1]=num; // 0,1,2,3,4 x++;counter1++;num=255; }

if(num==11)

{num=255; Beep_key(); if(counter1==1) {GG=table1[0];counter1=0;table1[0]=0;} if(counter1==2) {GG=table1[0]+table1[1];counter1=0;table1[0]=table1[1]=0;} if(counter1==3)

{GG=table1[0]+table1[1]+table1[2];counter1=0;table1[0]=table1[1]=table1[2]=0;} if(counter1==4)

{GG=table1[0]+table1[1]+table1[2]+table1[3];counter1=0;table1[0]=table1[1]=table1[2]=table1[3]=0;} if(counter1==5)

{GG=table1[0]+table1[1]+table1[2]+table1[3]+table1[4];counter1=0;table1[0]=table1[1]=table1[2]=table1[3]=table1[4]=0;} if(counter1==6)

{GG=table1[0]+table1[1]+table1[2]+table1[3]+table1[4]+table1[5];counter1=0;table1[0]=table1[1]=table1[2]=table1[3]=table1[4]=table1[5]=0;}

SectorErase(0X2000);byte_write(0X2000, GG); init_lcd();break; } } } }

void mimasuo() {

lcd_goto_xy(0,0);

33

lcd_puts(\ if((num<10)&&(x<6)) //A { lcd_goto_xy(5+x,1);Beep_key(); lcd_putc('*'); table1[counter1]=num; // 0,1,2,3,4 x++;counter1++;num=255; }

if(num==10)

{num=255;Beep_key(); if(counter1==1) {A=table1[0];counter1=0;table1[0]=0;} if(counter1==2) {A=table1[0]+table1[1];counter1=0;table1[0]=table1[1]=0;} if(counter1==3)

{A=table1[0]+table1[1]+table1[2];counter1=0;table1[0]=table1[1]=table1[2]=0;} if(counter1==4)

{A=table1[0]+table1[1]+table1[2]+table1[3];counter1=0;table1[0]=table1[1]=table1[2]=table1[3]=0;} if(counter1==5)

{A=table1[0]+table1[1]+table1[2]+table1[3]+table1[4];counter1=0;table1[0]=table1[1]=table1[2]=table1[3]=table1[4]=0;} if(counter1==6)

{A=table1[0]+table1[1]+table1[2]+table1[3]+table1[4]+table1[5];counter1=0;table1[0]=table1[1]=table1[2]=table1[3]=table1[4]=table1[5]=0;} GG=byte_read(0x2000); if(A==GG||flag1==1) { init_lcd();Beep_key();LED=0; lcd_goto_xy(0,0); lcd_puts(\ delay13(50000); delay13(50000);delay13(50000);delay13(50000);init_lcd(); JDQ=0;LED=1; lcd_goto_xy(0,0);lcd_puts(\ if(flag1==1) {lcd_goto_xy(4,1);lcd_puts(\ delay13(50000); delay13(50000);delay13(50000);delay13(50000);delay13(50000); delay13(50000);delay13(50000);delay13(50000); init_lcd(); while(1) { LED=0;beep=1; num=keyscan();//反复扫描4*4键盘获得按键参数 dis_timer(); set_time(); change_word(); if(num==10)

{Beep_key();init_lcd();beep=1;JDQ=1;LED=0;flag1=0;table1[0]=table1[1]=table1[2]=table1[3]=t

34