资源描述:
《指纹识别模块单片机程序》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、#include#include#defineTRUE1unsignedcharSaveNumber=0,searchnum=0;unsignedintSearchNumber=0;unsignedintclk0=0;sbitrelay=P1^4;//继电器引脚sbitbuzzer=P1^5;//蜂鸣器引脚sbitred=P2^7;//录入模式指示灯在板子靠近单片机处sbitgreen=P2^0;//识别模式指示灯在板子远离单片机处sbitk1=P3^3;
2、//模式识别sbitk2=P3^4;//录入一次指纹sbitk3=P3^2;//清除所有指纹(10个指纹清除)//变量定义:unsignedcharcodetab[10]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90};//表:共阳数码管0-9//数码管引脚定义:sbitSMG_g=P1^3;//定义数码管阳级控制脚(个位)//由于程序中定时器被用我们用一位数码管显示且为静太显示所以推荐大家用1602或者12864液晶bitchangefl
3、ag=0,modeflag=0,clearallflag=0;//默认为识别模式,如果为1为录入指纹模式,每录入一次SaveNumber++//////////////////////////////////////常用指令定义///////////////////////////////VerifyPassword:验证设备握手口令unsignedcharcodeVPWD[16]={16,0X01,0Xff,0xff,0xff,0xff,0x01,0,7,0x13,0x00,0x00,0x00
4、,0x00,0x00,0x1b};//回送12个//设置设备握手口令unsignedcharcodeSTWD[16]={16,0X01,0Xff,0xff,0xff,0xff,0x01,0,7,0x12,0x00,0x00,0x00,0x00,0x00,0x1a};//回送12个//GetImage:探测手指并从传感器上读入图像unsignedcharcodeGIMG[14]={12,0X01,0Xff,0xff,0xff,0xff,0x01,0,3,1,0x00,0x05};//回送12个//
5、GenTemplet1:根据原始图像生成指纹特征1unsignedcharcodeGENT1[14]={13,0X01,0Xff,0xff,0xff,0xff,0x01,0,4,2,1,0x00,0x08};//回送12个//GenTemplet2:根据原始图像生成指纹特征2unsignedcharcodeGENT2[14]={13,0X01,0Xff,0xff,0xff,0xff,0x01,0,4,2,2,0x00,0x09};//回送12个//SearchFinger:以CharBuffer
6、A或CharBufferB中的特征文件搜索整个或部分指纹库unsignedcharcodeSEAT[18]={17,0X01,0Xff,0xff,0xff,0xff,0x01,0,8,4,1,0,0,0,0x65,0x00,0x73};//回送16个//MergeTemplet;将CharBufferA与CharBufferB中的特征文件合并生成模板,结果存于ModelBuffer。unsignedcharcodeMERG[14]={12,0X01,0Xff,0xff,0xff,0xff,0x0
7、1,0,3,5,0x00,0x09};//回送12个//StoreTemplet:将ModelBuffer中的文件储存到flash指纹库中unsignedcharcodeSTOR[16]={15,0X01,0Xff,0xff,0xff,0xff,0x01,0,6,6,2,0x00,0x00,0x00,0x0f};//回送12个//ReadNoteunsignedcharcodeRDNT[14]={13,0X01,0Xff,0xff,0xff,0xff,0x01,0,4,0x19,0,0x00,0
8、x1e};//ClearNoteunsignedcharcodeDENT[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};//DELonetempletunsignedcharcodeDELE_one[16]={16,0X01,0Xff,0xff,0xff,0xff,0x01,0,7,0x0c,0