return0x00; } // unsigned char key_pro()//返回按键的逻辑键值 // { // unsigned char keynum; // keynum = key_scan(); //switch(keynum) // { //case0x7e :return0;break; //case0xbe :return1;break; //case0xde :return2;break; //case0xee :return3;break; //case0x7d :return4;break; //case0xbd :return5;break; //case0xdd :return6;break; //case0xed :return7;break; //case0x7b :return8;break; //case0xbb :return9;break; //case0xdb :return10;break; //case0xeb :return11;break; //case0x77 :return12;break; //case0xb7 :return13;break; //case0xd7 :return14;break; //case0xe7 :return15;break; //default:return16;break; // } // }
此处将逻辑键值注释掉是因为,我在编译代码下载到51板子上时,代码总量超过了51单片机的最大容量,所以在程序中直接选用物理键值。

key.h

#ifndef _KEY_H#define _KEY_Hextern unsignedchar key_scan(void); extern unsignedchar key_pro(); #endif