#include<regx52.h>
typedef unsigned char u8;
typedef unsigned int u16;
#define smg_a_dp_port P0
#define key_matrix_port P1
u8 gsmg_code[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,
0x71};//共阴极数码管显示0-F
void delay(xms) //@11.0592MHz
{
unsigned char i, j;
while(xms--)
{
i = 180;
j = 73;
do
{
while (--j);
} while (--i);
}
}
u8 key_matrix_ranks_scan(void)
{
u8 key_value=0;
key_matrix_port=0xf7;//第一列为低电平
if(key_matrix_port!=0xf7);//按键按下
{
delay(1);
switch(key_matrix_port)
{
case 0x77:key_value=1;break;