#ifndef _KEY_44_H
#define _KEY_44_H
void key_Init(void);
unsigned char keysoan(void);
unsigned char key_v_fun(unsigned char key_n);
void delay(tWord i);
#endif
/*--------------------------------------------*-
-----EDN OF FILE--------------------------------
-*-------------------------------------*/
// #include<reg52.h>
#include"Main.h"
#include"key_44.h"
#define unit unsigned int
#define tByte unsigned char
void delay(uint i);
/*-------------------------------------------------------*-
key_Init()
Initialization function for the DISPLAY COUNT library.
-*-------------------------------------------------------*/
void key_Init(void)
{
;
}
tByte keyscan(void) //键盘扫描函数
{
tByte cord_h,cord_1;
P1=0x0f;
cord_1=P1&0x0f;
if(cord_1!=0x0f)
{
delay(100);
if(cord_1!=0x0f)
{
cord_1=P1&0x0f;
P1=cord_1|0xf0;
cord_h=P1&0xf0;
return(cord_h+cord_1);
}
}return(0xff);//返回该值
}
/*----------------------------------*-
key_v_fun()
Simple function to display tByte date (COUNT)
on LEDs connect to port (Count_Port)
-*---------------------------------*/
tByte key_v_fun(tByte key_n)
{
tByte key_v;
swith(key_n)
{
case 0x7e:key_v=0;
break;
case 0x7d:key_v=1;
break;
case 0x7b:key_v=2;
break;
case 0x77:key_v=3;
break;
case 0xbe:key_v=4;
break;
case 0xbd:key_v=5;
break;
case 0xbb:key_v=6;
break;
case 0xb7:key_v=7;
break;
case 0xde:key_v=8;
break;
case 0xdd:key_v=9;
break;
case 0xdb:key_v=0xa;
break;
case 0xd7:key_v=0xb;
break;
case 0xee:key_v=0xc;
break;
case 0xed:key_v=0xd;
break;
case 0xeb:key_v=0xe;
break;
case 0xe7:key_v=0xf;
break;
default:key_v=0xff;
break;
}
return(key_v);
}
void delay(tWord i) //延时函数
{
while(i--);
}
/*--------------------------------------------*-
-----EDN OF FILE--------------------------------
-*-------------------------------------*/