34 基于单片机的指纹打卡系统-三、程序编程

#include < reg52.h >#include < character.h >#include < lcd.h >\
#include<string.h>#include<stdio.h>#include<intrins.h>#include<stdlib.h>#define INT8U unsigned char#define INT16U unsigned intsbit key1 = P0^0;
sbit key2 = P0^1;
sbit key3 = P0^2;
sbit key4 = P0^3;
sbit beep = P0^4;

INT8U code FFW_ARR\[\]={0x01,0x03,0x02,0x06,0x04,0x0C,0x08,0x09}; 
INT8U n = 1;/*函数定义*/void ajpd(); //按键判断函数void jiemian1(void)			  //界面1    请按指纹{				   
	Lcd\_Character\_16X16( 1, 0, 0 , function_logo\[5\]);  // 
	Lcd\_Character\_16X16( 1, 0, 16 , function_logo\[6\]);  // 
	Lcd\_Character\_16X16( 1, 0, 32 , function_logo\[7\]);  // 
	Lcd\_Character\_16X16( 1, 0, 48 , function_logo\[8\]);  //	}void jiemian2(void)			  //界面2{				   
	Lcd\_Character\_16X16( 1, 0, 0 , function_logo\[0\]);  // 比
	Lcd\_Character\_16X16( 1, 0, 16 , function_logo\[1\]);  // 对
	Lcd\_Character\_16X16( 1, 0, 32 , function_logo\[2\]);  // 成
	Lcd\_Character\_16X16( 1, 0, 48 , function_logo\[3\]);  //	功}void jiemian3(void)			  //界面3  请再次按下指纹 {				   
	Lcd\_Character\_16X16( 1, 0, 0 , function_logo\[9\]);  // 
	Lcd\_Character\_16X16( 1, 0, 16 , function_logo\[10\]);  // 
	Lcd\_Character\_16X16( 1, 0, 32 , function_logo\[11\]);  // 
	Lcd\_Character\_16X16( 1, 0, 48 , function_logo\[12\]);  //	
	Lcd\_Character\_16X16( 1, 0, 64 , function_logo\[13\]);  // 
	Lcd\_Character\_16X16( 1, 0, 80 , function_logo\[14\]);  // 
	Lcd\_Character\_16X16( 1, 0, 96 , function_logo\[15\]);  //}void jiemian4(void)			  //界面4  比对失败{				   
	Lcd\_Character\_16X16( 1, 0, 0 , function_logo\[0\]);  // 
	Lcd\_Character\_16X16( 1, 0, 16 , function_logo\[1\]);  // 
	Lcd\_Character\_16X16( 1, 0, 32 , function_logo\[4\]);  // 
	Lcd\_Character\_16X16( 1, 0, 48 , function_logo\[16\]);  //	}void jiemian5(void)			  //界面4   开机中{				   
	Lcd\_Character\_16X16( 1, 0, 32 , function_logo\[17\]);  // 
	Lcd\_Character\_16X16( 1, 0, 48 , function_logo\[18\]);  // 
	Lcd\_Character\_16X16( 1, 0, 64 , function\_logo\[19\]);  // }void delay\_ms(INT16U x){
	INT8U t=120;	while(x--)		while(t--);
}void STEP_FFW(INT8U n){
	INT8U i,j;	
	for(i=0; i<5*n; i++)
	{		for(j=0; j<8; j++)
		{
			P1=FFW\_ARR\[j\];			delay\_ms(60);
		}
	}
}void main(void){	Lcd_Initial();     //LCD初始化
	Lcd\_Display\_On();	//启动屏幕
	jiemian5();	Delay(1000);	Lcd_Clear();
	beep = 0;	while(1)
	{		 ajpd();//按键判断
	}
}void ajpd(){	if(key1 == 0)  //指纹开
	{		Lcd_Clear();
		beep = 0;		jiemian2();		STEP_FFW(n);		while(!key1);
	}	
  if(key2 == 0)  //指纹关
	{		Lcd_Clear();		jiemian4();
		beep = 1;		while(!key2);
	}	
	if(key3 == 0)
	{		Lcd_Clear();
		beep = 0;		jiemian1();		while(!key3);
	}	
	if(key4 == 0)
	{		Lcd_Clear();
		beep = 0;		jiemian3();		while(!key4);
	}
}
上一篇:金铲铲S13双城之战自动拿牌助手