主程序部分
#include <reg52.h>
#include <intrins.h>
#include "LCD12864.h"
#include "at24c02.h"
#define buffer1ID 0x01
#define buffer2ID 0x02
#define confirm 0x88
#define quit 0x84
#define backspace 0x82
#define user 1
void begin();
sbit B0=B^0;
sbit B7=B^7;
sbit k2=P3^7;
sbit jidianqi=P3^6;
sbit feng=P2^0;
extern unsigned char times[];
unsigned char member=1,sec;
unsigned char errorcount;
unsigned char code buffer[user][6]=
{
{
"000000"}
} ;
unsigned char dz[4];
unsigned char time[4];
unsigned char password[6];
unsigned char passwordid[6]={
1,2,3,4,5,6};
unsigned char address1=20,tempx=20;
unsigned char address2=20;
unsigned char data K;
unsigned char data key;
unsigned int pageid;
unsigned char data confirmcode=11;
unsigned char sum[2];
int summaf,summas;
unsigned char xdata userpassword[7]={
0};
unsigned char xdata fingerprint_holder[16]={
0};
void delayms(unsigned int t)
{
unsigned int i,j;
for(i=t;i>0;i--);
for(j=110;j>0;j--);
}
void redray_init(void);
#include "zhiwen.h"
unsigned char redray_change(unsigned char rednum);
void UsartConfiguration()
{
SCON=0x50;
TMOD=0x21;
PCON=0x00;
TH1=0xFD;
TL1=0xFD;
TR1=1;
EA=1;
}
void keyboard(unsigned char key)
{
if(key!=0)
{
switch(key)
{
case(0x11):K=1;break;
case(0x21):K=2;break;
case(0x41):K=3;break;
case(0x81):K='A';break;
case(0x12):K=4;break;
case(0x22):K=5;break;
case(0x42):K=6;break;
case(0x82):K=34;break;
case(0x14):K=7;break;
case(0x24):K=8;break;
case(0x44):K=9;break;
case(0x84):K='C';break;
case(0x18):K='*';break;
case(0x28):K=0;break;
case(0x48):K=11;break;
case(0x88):K='D';break;
default:break;
}
}
}
unsigned char keyscan(void)
{
unsigned char rowcode,colcode;
P1=0xf0;
if((P1&0xf0)!=0xf0)
{
delayms(1);
if((P1&0xf0)!=0xf0)
{
rowcode=0xfe;
while((rowcode&0x10)!=0)
{
P1=rowcode;
if((P1&0xf0)!=0xf0)
{
colcode=(P1&0xf0)|0x0f;
while((P1&0xf0)!=0xf0)
return ((~rowcode)+(~colcode));
}
else
rowcode=(rowcode<<1)|0x01;
}
}
}
return 0;
}
unsigned char check(unsigned char user_password)
{
unsigned char flag,i,temp[6],address;
address=user_password*10;
for(i=0;i<6;i