|
#include<reg52.h>
#include<LCD1602.h>
#include<anjian.h>
#define uchar unsigned char
//****************************************************
//MS延时函数(12M晶振下测试)
//****************************************************
void Delay_ms(unsigned int m)
{
unsigned int i;
unsigned long j;
for(i = 0; i < m; i++)
for(j = 0; j < 123; j++);
}
void main(){
char key_data;
Init_LCD1602(); //初始化LCD1602
//LCD1602_write_com(0x80); //指针设置到第一行第1列
// Delay_ms(100);
//LCD1602_write_word(" input telephone:"); //第一行显示的
L1602_string(1,1," 4*4KeyBoard ");
L1602_string(2,1,"Please Press key");
while(1)
{
P2=0xf0;
if(P2!=0xf0){
Delay_ms(10);
if(P2!=0xf0)
{
key_data=Keyscan();
}
}
L1602_char(2,15,key_data/10+48);
L1602_char(2,16,key_data%10+48);
}
}
|
|