`
- #include
- #include
- typedef unsigned char uchar;
- typedef unsigned int uint;
- //#define MAXSIZE 50
- ***it LED1 = P1^0;
- ***it LED8 = P1^1;
- ***it LED2 = P1^2;
- ***it K1 = P2^7;
- uchar a = 0;
- uint summas;
- uchar sum[2];
- uchar coNFCode; //指纹模块应答确认码
- //uchar arr_mem[MAXSIZE];
- //uchar head, tail;
- //FINGERPRINT通信协议定义
- unsigned char FP_Pack_Head[6] = {0xEF,0x01,0xFF,0xFF,0xFF,0xFF}; //协议包头
- unsigned char PF_Verify_Pwd[10] = {0x01, 0x00, 0x07, 0x13, 0X00, 0X00, 0X00, 0X00, 0x00, 0x1b}; // 验证口令, 模块才正常工作
- unsigned char FP_Get_Img[6] = {0x01,0x00,0x03,0x01,0x00,0x05}; //获得指纹图像
-
- unsigned char FP_Change_Com[8] = {0x01,0x0,0x05,0x0e,0x04,0x01,0x0,0x19}; //修改波特率 9600
-
- unsigned char FP_Templete_Num[6] ={0x01,0x00,0x03,0x1D,0x00,0x21 }; //获得模版总数
- unsigned char FP_Search[11]={0x01,0x0,0x08,0x04,0x01,0x0,0x0,0x03,0xA1,0x0,0xB2}; //搜索指纹搜索范围0 - 929
- unsigned char FP_Search_0_9[11]={0x01,0x00,0x08,0x04,0x01,0x00,0x00,0x00,0x13,0x00,0x21}; //搜索0-9号指纹
- unsigned char FP_Img_To_Buffer1[7]={0x01,0x00,0x04,0x02,0x01,0x00,0x08}; //将图像放入到BUFFER1
- unsigned char FP_Img_To_Buffer2[7]={0x01,0x00,0x04,0x02,0x02,0x00,0x09}; //将图像放入到BUFFER2
- unsigned char FP_Reg_Model[6]={0x01,0x0,0x03,0x05,0x0,0x09}; //将BUFFER1跟BUFFER2合成特征模版
-
- unsigned char code FP_Delet_All_Model[6]={0x01,0x0,0x03,0x0d,0x00,0x11}; //删除指纹模块里所有的模版
- volatile unsigned char xdata FP_Save_Finger[9]={0x01,0x00,0x06,0x06,0x01,0x00,0x0B,0x00,0x19}; //将BUFFER1中的特征码存放到指定的位置
- volatile unsigned char xdata FP_Delete_Model[10]={0x01,0x00,0x07,0x0C,0x0,0x0,0x0,0x1,0x0,0x0}; //删除指定的模版
- void UART_Init() // 通信波特率9600
- {
- TMOD = 0x20;
- // PCON = 0x80;
- TH1 = 0xfd;
- TL1 = 0xfd;
- TR1 = 1;
- SM0 = 0;
- SM1 = 1;
- REN = 1;
- ES = 1;
- EA = 1;
- }
- void UART_Send_Byte(uchar c) // 发送一个字节的数据
- {
- // TI = 0;
- SBUF = c;
- while(!TI);
- TI = 0;
- }
- void Delay_1ms(uint z)
- {
- uchar x, y;
- for (x = z; x > 0; x--)
- for (y = 110; y > 0; y--);
- }
复制代码
`
|