指纹识别模块单片机程序
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
#include
#include
#define TRUE 1
unsigned char SaveNumber=0,searchnum=0;
unsigned int S earchNumber=0;
unsigned int clk0=0;
sbit relay =P1^4; //继电器引脚
sbit buzzer=P1^5; //蜂鸣器引脚
sbit red= P2^7;//录入模式指示灯在板子靠近单片机处
sbit green= P2^0;//识别模式指示灯在板子远离单片机处
sbit k1=P3^3; //模式识别
sbit k2=P3^4; //录入一次指纹
sbit k3=P3^2; //清除所有指纹(10个指纹清除)
//变量定义:
unsigned char code tab[10]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90};//表:共阳数码管0-9
//数码管引脚定义:
sbit SMG_g = P1^3; //定义数码管阳级控制脚(个位)
//由于程序中定时器被用我们用一位数码管显示且为静太显示所以推荐大家用1602或者12864液晶
bit changeflag=0,modeflag=0,clearallflag=0; //默认为识别模式,如果为1为录入指纹模式,每录入一次SaveNumber++
//////////////////////////////////////常用指令定义/////////////////////////////
//Verify Password :验证设备握手口令
unsigned char code VPWD[16]={16,0X01 ,0Xff,0xff,0xff,0xff, 0x01,0,7,0x13,0x00,0x00,0x00,0x00,0x00,0x1b}; //回送12个
//设置设备握手口令
unsigned char code STWD[16]={16,0X01 ,0Xff,0xff,0xff,0xff, 0x01,0,7,0x12,0x00,0x00,0x00,0x00,0x00,0x1a}; //回送12个
//GetImage :探测手指并从传感器上读入图像
unsigned char code GIMG[14]={12, 0X01 ,0Xff,0xff,0xff,0xff, 0x01, 0,3,1,0x00,0x05}; //回送12个
//Gen Templet1 :根据原始图像生成指纹特征1
unsigned char code GENT1[14]={13,0X01 ,0Xff,0xff,0xff,0xff,0x01,0,4,2,1,0x00,0x08}; //回送12个
//Gen Templet2 :根据原始图像生成指纹特征2
unsigned char code GENT2[14]={13,0X01 ,0Xff,0xff,0xff,0xff,0x01,0,4,2,2,0x00,0x09}; //回送12个
//Search Finger :以CharBufferA或CharBufferB中的特征文件搜索整个或部分指纹库unsigned char code SEAT[18]={17, 0X01 ,0Xff,0xff,0xff,0xff, 0x01, 0,8, 4,1,0,0, 0,0x65, 0x00,0x73}; //回送16个
//Merge Templet ;将CharBufferA与CharBufferB中的特征文件合并生成模板,结果存于ModelBuffer。
unsigned char code MERG[14]={12, 0X01 ,0Xff,0xff,0xff,0xff, 0x01, 0,3,5 , 0x00,0x09};//回送12个
//Store Templet :将ModelBuffer中的文件储存到flash指纹库中
unsigned char code STOR[16]={15, 0X01 ,0Xff,0xff,0xff,0xff, 0x01, 0,6,6,2, 0x00,0x00, 0x00,0x0f}; //回送12个
//Read Note
unsigned char code RDNT[14]={13,0X01 ,0Xff,0xff,0xff,0xff, 0x01, 0,4,0x19, 0, 0x00,0x1e};
//Clear Note
unsigned char code DENT[46]={45,0X01 ,0Xff,0xff,0xff,0xff, 0x01, 0,36,0x18,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x00,0x3d};
//DEL one templet
unsigned char code DELE_one[16]={16, 0X01 ,0Xff,0xff,0xff,0xff, 0x01, 0,7, 0x0c,0x00,0x00, 0,1, 0x00,0x15};
//DEL templet ;清空指纹库
unsigned char code DELE_all[12]={12,0X01 ,0Xff,0xff,0xff,0xff, 0x01, 0,3, 0x0d,0x00,0x11}; ////////////////常用指令定义-------结束///////////////////////////////////////////////////////////////////////////////////////