|
发表于 2008-1-8 16:32:59
|
显示全部楼层
我的程序也是参考网站上的程序弄得,有可能是完全一样 呵呵
菜单是实现了,我是12864的屏幕,大家可以讨论一下 ,我也看了傻孩子的程序了,我看了好几天 才有了头绪,本人比较笨 呵呵
void CheckKey(void)
{
unsigned char Key;
Key = KeyCode;
switch(Key){
case JINGHAOKEYCODE:{ //向上键,找出新的菜单状态编号
KeyFuncIndex=KeyTab[KeyFuncIndex].KeyUpState;
KeyFuncPtr=KeyTab[KeyFuncIndex].CurrentOperate;
(*KeyFuncPtr)();//执行当前按键的操作
break;
}
case XINHAOKEYCODE:{ //向下键,找出新的菜单状态编号
KeyFuncIndex=KeyTab[KeyFuncIndex].KeyDnState;
KeyFuncPtr=KeyTab[KeyFuncIndex].CurrentOperate;
(*KeyFuncPtr)();//执行当前按键的操作
break;
}
case EIGHTKEYCODE:{ //向左键,找出新的菜单状态编号
KeyFuncIndex=KeyTab[KeyFuncIndex].KeyLState;
KeyFuncPtr=KeyTab[KeyFuncIndex].CurrentOperate;
(*KeyFuncPtr)();//执行当前按键的操作
break;
}
case ZEROKEYCODE:{ //向右键,找出新的菜单状态编号
KeyFuncIndex=KeyTab[KeyFuncIndex].KeyRState;
KeyFuncPtr=KeyTab[KeyFuncIndex].CurrentOperate;
(*KeyFuncPtr)();//执行当前按键的操作
break;
case 0xaa:
{
KeyFuncPtr=KeyTab[MainMenuIndex].CurrentOperate;
(*KeyFuncPtr)();
}
break;
default:break;
}
}
KeyCode=0;
}
struct KbdTabStruct
{
unsigned char KeyStateIndex; //当前状态索引号
unsigned char KeyUpState; //按下"向上"键时转向的状态索引号
unsigned char KeyDnState; //按下"向下"键时转向的状态索引号
unsigned char KeyLState; //按下"向左"键时转向的状态索引号
unsigned char KeyRState; //按下"向右"键时转向的状态索引号
void (*CurrentOperate)(); //当前状态应该执行的功能操作
}KeyTab[60]@0x2d0; // |
|