1、程序:#include #include #define uchar unsigned char#define uint unsigned int#define Dbus P0#define buffer1ID 0x01#define buffer2ID 0x02#define queren 0x88#define tuichu 0x84#define shanchu 0x82sbit B0=B0;sbit B7=B7;sbit jidianqi=P36;sbit RS=P22; sbit RW=P21;sbit E1=P20;sbit LEDK=P34; /控制背光sbit SCLK=P23
2、;sbit IO=P25;sbit RST=P24;uchar code ta8=0x00,0x51,0x09,0x10,0x05,0x02,0x11,0xbe;uchar data a7; / 秒 分 时 日 月 星期 年 uchar dz4; /存键输入值uchar mima7;uchar mimaID6=1,2,3,4,5,6;uchar data K;uchar data Key;uint PageID;uchar data querenma;uchar sum2;int summaf,summas;uchar code nian=“年“;uchar code yue=“月“;ucha
3、r code ri=“日“;uchar code xinqi=“星期“;uchar code mao=0x3a;unsigned char code text1=“ 请按指纹 “;unsigned char code text2=“ 请再次按指纹 “;unsigned char code text3=“ 指纹采集成功 “;unsigned char code text4=“请按任意键继续 “; unsigned char code text5=“ 指纹采集失败 “;unsigned char code text6=“输入删去的指纹号“;unsigned char code text7=“ 删指
4、纹号成功 “;unsigned char code text8=“按键一:增加指纹“;unsigned char code text9=“按键二:删去指纹“;unsigned char code text10=“ 请重新按指纹 “;unsigned char code text11=“清空指纹库成功 “; unsigned char code text12=“ 没搜索到指纹 “; unsigned char code text13=“请先按键再刷指纹“;unsigned char code text14=“ 请重新操作 “; unsigned char code text15=“ 删去失败 “
5、; unsigned char code text16=“ 接收包出错 “;unsigned char code text17=“ 编号为: “;unsigned char code text18=“指纹已找到 请进“;unsigned char code text19=“ 该指纹已存储 “;unsigned char code text20=“ 请输入密码 “;unsigned char code text21=“ 密码错误 “;unsigned char code text22=“按键三:更新密码“; / unsigned char code text23=“请再次输入密码 “; unsi
6、gned char code text24=“两次输入的密码不“;unsigned char code text25=“一致,请重新操作“; unsigned char code text26=“ 密码更新成功 “; 另外:void delay(uint tt) uchar i;while(tt-)for(i=0;i4; n4=a6WriteCommand(0x90); /指定第二行显示位置WriteData(0x32);WriteData(0x30);WriteData(0x30+n3);WriteData(0x30+n4);for(i=0;i4; y2=a4WriteData(0x30+y
7、1);WriteData(0x30+y2);for(i=0;i4; r2=a3WriteData(0x30+r1);WriteData(0x30+r2);for(i=0;i4;s2=a2 f1=a14;f2=a1 m1=a04;m2=a0WriteCommand(0x98); /指定第四行显示位置WriteData(0x30+s1);WriteData(0x30+s2);WriteData(mao);WriteData(0x30+f1);WriteData(0x30+f2);WriteData(mao);WriteData(0x30+m1);WriteData(0x30+m2);/*/1286
8、4/*/ds1302 控制uchar r1302() /读数据 ds1302 uchar i;for(i=0;i=1; B7 = IO; SCLK=1;SCLK=0; return B;void w1302(uchar co) / 写 ds1302 单字节 uchar i; B = co;for(i=0;i=1;void w(uchar a, uchar d) /寻址,写数 RST = 0;SCLK = 0;RST = 1;w1302(a); w1302(d); SCLK = 1;RST = 0;uchar r(uchar a) /寻址,读数 uchar r;RST = 0;SCLK = 0;
9、RST = 1;w1302(a); r=r1302(); SCLK = 1;RST = 0;return r;void wclo(uchar *p) /写多字节 ds1302uchar i;w(0x8e,0x00); /写允许 RST=0;SCLK=0;RST=1;w1302(0xbe); /写多字节命令 for(i=0;i8;SBUF=sum1;while(TI=0)TI=0;SBUF=sum0;while(TI=0)TI=0;for(i=0;i=1011 querenma=0x18? uchar i,ID1,ID2;SBUF=0xef;while(TI=0);TI=0;SBUF=0X01;
10、while(TI=0);TI=0;SBUF=0XFF;while(TI=0);TI=0;SBUF=0XFF;while(TI=0);TI=0;SBUF=0XFF;while(TI=0);TI=0;SBUF=0XFF;while(TI=0);TI=0;SBUF=0X01;while(TI=0);TI=0;SBUF=0X00;while(TI=0);TI=0;SBUF=0X06;while(TI=0);TI=0;SBUF=0X06;while(TI=0);TI=0;SBUF=0X01;while(TI=0);TI=0;ID1=pageID;ID2=pageID8;SBUF=ID2;while(TI
11、=0);TI=0;SBUF=ID1;while(TI=0);TI=0;summaf=0x0e+ID1+ID2;sum0=summaf;sum1=summaf8;SBUF=sum1;while(TI=0);TI=0;SBUF=sum0;while(TI=0);TI=0;for(i=0;i255 都会使程序卡uchar i,ID1,ID2;SBUF=0xef;while(TI=0);TI=0;SBUF=0X01;while(TI=0);TI=0;SBUF=0XFF;while(TI=0);TI=0;SBUF=0XFF;while(TI=0);TI=0;SBUF=0XFF;while(TI=0);T
12、I=0;SBUF=0XFF;while(TI=0);TI=0;SBUF=0X01;while(TI=0);TI=0;SBUF=0X00;while(TI=0);TI=0;SBUF=0X08;while(TI=0);TI=0;SBUF=0X1b;while(TI=0);TI=0;SBUF=bufferID;while(TI=0);TI=0;SBUF=0X00;while(TI=0);TI=0;SBUF=0;while(TI=0);TI=0;SBUF=0X00;while(TI=0);TI=0;SBUF=180;while(TI=0);TI=0;summaf=9+0x1b+bufferID+180
13、;sum0=summaf;sum1=summaf8;SBUF=sum1;while(TI=0);TI=0;SBUF=sum0;while(TI=0);TI=0;for(i=0;i8;SBUF=ID2;while(TI=0);TI=0;SBUF=ID1;while(TI=0);TI=0;SBUF=0X00;while(TI=0);TI=0;SBUF=1;while(TI=0);TI=0;summaf=0x15+ID1+ID2;sum0=summaf;sum1=summaf8;SBUF=sum1;while(TI=0);TI=0;SBUF=sum0;while(TI=0);TI=0;for(i=0
14、;i=0)if(j=1)PageID=dz1+dz0*10;if(j=0)PageID=dz0;SFG_deletchar(PageID);if(querenma=0)Clrram();WriteCommand(0x90); /指定第二行显示位置 显示删除成功for(i=0;i=0)if(j6)WriteCommand(0x88+j); /指定第三行显示位置WriteData(0x0f);+j;if(j=7)j=6; /#yinhuang /显示 LCD12864 并行显示 if(K=34) /按了删除键if(j=0)WriteCommand(0x88); /指定第三行显示位置WriteDat
15、a(0x20);else-j;WriteCommand(0x88+j); /指定第三行显示位置WriteData(0x20);Clrram();if(mima10=mima20)i6;i+)mimaIDi=mima1i;WriteCommand(0x80); /指定第二行显示位置for(i=0;i16;i+)WriteData(text26i); /显示 LCD12864 并行显示 密码更新成功WriteCommand(0x88); /指定第二行显示位置for(i=0;i16;i+)WriteData(text4i); /显示 LCD12864 并行显示 请按任意键继续while(Keycan()=0);