指纹识别模块程序及原理图
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
程序:
#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 0x82
sbit B0=B^0;
sbit B7=B^7;
sbit jidianqi=P3^6;
sbit RS=P2^2;
sbit RW=P2^1;
sbit E1=P2^0;
sbit LEDK=P3^4; //控制背光
sbit SCLK=P2^3;
sbit IO=P2^5;
sbit RST=P2^4;
uchar code ta[8]={0x00,0x51,0x09,0x10,0x05,0x02,0x11,0xbe}; uchar data a[7]; // 秒分时日月星期年
uchar dz[4]; //存键输入值
uchar mima[7];
uchar mimaID[6]={1,2,3,4,5,6};
uchar data K;
uchar data Key;
uint PageID;
uchar data querenma;
uchar sum[2];
int summaf,summas;
uchar code nian[]={"年"};
uchar code yue[]={"月"};
uchar 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[]={" 删指纹号成功"};
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[]={" 删去失败"};
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[]={"请再次输入密码"};
unsigned char code text24[]={"两次输入的密码不"};
unsigned char code text25[]={"一致,请重新操作"};
unsigned char code text26[]={" 密码更新成功"};
另外:
void delay(uint tt)
{ uchar i;
while(tt--)
{
for(i=0;i<125;i++);
}
}
void initialize51()
{
SCON= 0x50; //串口方式1 //REN=1; 允许接收
PCON=0x80; //SMOD=1
TMOD= 0x20; //定时器1定时方式2
TH1= 0xff; //11.0592MHz 模块默认波特率为57600bps TL1= 0xff;
TR1= 1; //启动定时器
}
unsigned char Keycan(void) //按键扫描程序P1.0--P1.3为行线P1.4--P1.7为列线{
unsigned char rcode, ccode;
P1 = 0xF0; // 发全0行扫描码,列线输入
if((P1&0xF0) != 0xF0) // 若有键按下
{
delay(1);// 延时去抖动
if((P1&0xF0) != 0xF0)
{ rcode = 0xFE; // 逐行扫描初值
while((rcode&0x10) != 0)
{
P1 = rcode; // 输出行扫描码
if((P1&0xF0) != 0xF0) // 本行有键按下
{
ccode = (P1&0xF0)|0x0F;
//do{;}
while((P1&0xF0) != 0xF0); //等待键释放
return ((~rcode) + (~ccode)); // 返回键编码
}
else
rcode = (rcode<<1)|0x01; // 行扫描码左移一位
}
}
}
return 0; // 无键按下,返回值为0
}
void KeyDeal(unsigned char Key)
{ //unsigned char n;
if(Key!=0)
{
switch(Key)
{
case 0x11: K=1; break;
case 0x21: K=2; break;