C51 程序设计的菜单的代码实例 /* Module :Kbdmenu
c Date:------ Usage:P10~P12 use to DownKey,UpKey,CRKey */ #include #include #define SIZE_OF_KEYBD_MENU 20 //菜单长度 uchar KeyFuncIndex=0; //uchar KeyFuncIndexNew=0; void (*KeyFuncPtr)(); //按键功能指针 typedef struct { uchar KeyStateIndex; //当前状态索引号 uchar KeyDnState; //按下"向下"键时转向的状态索引号 uchar KeyUpState; //按下"向上"键时转向的状态索引号 uchar KeyCrState; //按下"回车"键时转向的状态索引号 void (*CurrentOperate)(); //当前状态应该执行的功能操作 } KbdTabStruct; KbdTabStruct code KeyTab[SIZE_OF_KEYBD_MENU]= { { 0, 0, 0, 1,(*DummyJob)},//顶层 { 1, 2, 0, 3,(*DspUserInfo)},//第二层 { 2, 1, 1, 9,(*DspServiceInfo)}, //第二层 { 3, 0, 0, 1,(*DspVoltInfo)},//第三层>>DspUserInfo 的展开 { 4, 0, 0, 1,(*DspCurrInfo)},//第三层>>DspUserInfo 的展开 { 5, 0, 0, 1,(*DspFreqInfo)},//第三层>>DspUserInfo 的展开 { 6, 0, 0, 1,(*DspCableInfo)},//第三层>>DspUserI