📄 menu.lst
字号:
C51 COMPILER V7.07 MENU 02/01/2007 14:22:48 PAGE 1
C51 COMPILER V7.07, COMPILATION OF MODULE MENU
OBJECT MODULE PLACED IN menu.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE menu.c BROWSE DEBUG OBJECTEXTEND
stmt level source
1 /**********************************多级菜单LCD显示********************************************/
2 /*********作者:王胜文。QQ:95201972 email:nunk@163.com 希望与大家交流2007。08。03**********/
3
4
5 #include<reg51.h>
6 #include<drive_functions.h>
7 #include<get_keys.h>
8 #include<characters.h>
9 #include<menu_functions.h>
*** WARNING C275 IN LINE 1056 OF MENU_FUNCTIONS.H: expression with possibly no effect
10 void (*current_operation_index)();
11 uchar func_index=0;
12 uchar func_index;
13 bit enter_flag=0;
14
15 typedef struct
16 {
17 uchar current; //当前执行的函数索引
18 uchar up; //按向上键时转向执行函数的索引
19 uchar down; //按向下键时转向执行函数的索引
20 uchar enter; //按回车键时转向执行函数的索引
21 void (*current_operation)(); //当前执行函数的指针
22 } key_table;
23
24 key_table code table[28]=
25 {
26 {0,24,8,1,(*fun0)}, //第一层,显示[贵州],四川,广东,返回
27 {1,7,3,2,(*fun1)},//按回车,进第二层,显示[贵阳],刘盘水,黄平,返回
28 {2,2,2,1,(*fun2)},//enter>guiyang is the capital of guizhou,[return]
29
30 {3,1,5,4,(*fun4)},//向下,显示贵阳,[六盘水],黄平,返回
31 {4,4,4,3,(*fun5)},//liupanshui is a base of coal mine of southern of china
32
33 {5,3,7,6,(*fun7)},//向下,显示贵阳,六盘水,[黄平],返回
34 {6,6,6,5,(*fun8)}, //huangping is my hometown,[return]
35
36 {7,5,1,0,(*fun10)},//贵阳,六盘水,黄平,[返回][
37
38 {8,0,16,9,(*fun12)},//贵州,[四川],广东,返回
39 {9,15,11,10,(*fun13)},//[成都],绵阳,乐山,返回
40 {10,10,10,9,(*fun14)},//chengdu is the capital of sichuan province,[return]
41
42 {11,9,13,12,(*fun16)},//成都,[绵阳],乐山,返回
43 {12,12,12,11,(*fun17)},//miangyang is a technology city of western china,[return]
44
45 {13,11,15,14,(*fun19)},//成都,绵阳,[乐山],返回
46 {14,14,14,13,(*fun20)},//leshan have leshan dafu,[return]
47
48 {15,13,9,8,(*fun22)},//down>成都,绵阳,乐山,[返回]
49
50 {16,8,24,17,(*fun24)},//down>贵州,四川,[广东],返回
51 {17,23,19,18,(*fun25)},//enter>[深圳],广州,惠州,返回
52 {18,18,18,17,(*fun26)},//enter>i'm now in shenzhen,[return]
53
54 {19,17,21,20,(*fun28)},//down>深圳,[广州],惠州,返回
C51 COMPILER V7.07 MENU 02/01/2007 14:22:48 PAGE 2
55 {20,20,20,19,(*fun29)}, //enter>guangzhou is the capital of guangdong,return
56
57 {21,19,23,22,(*fun31)},//down>深圳,广州,[惠州],返回
58 {22,22,22,21,(*fun32)},//i'm in huizhou in 1997,[return]
59
60 {23,21,17,16,(*fun34)},//深圳,广州,惠州,[返回]
61
62 {24,16,0,25,(*fun36)},//贵州,四川,广东,[返回]
63 {25,26,26,27,(*fun37)},//[关闭],重启
64 {26,25,25,0,(*fun38)}, //关闭,[重启]
65 {27,27,27,27,(*fun39)}//关闭
66
67 };
68
69
70
71 void main(void)
72 {
73 1
74 1 current_operation_index=fun0;//初始化函数指针,使程序运行时执行第一个函数功能
75 1
76 1 while(1)
77 1 {
78 2 if(CheckState()) //检查是否有键按下
79 2 {
80 3 delay(); //延时去抖动
81 3
82 3 if(CheckState())
83 3 {
84 4 key=GetKeys(); //读取键盘值
85 4
86 4
87 4 /*******************find index****************************/
88 4 switch(key)
89 4 {
90 5 case 0x14:
91 5 func_index=table[func_index].up; //向上翻
92 5 break;
93 5 case 0x24:
94 5 func_index=table[func_index].enter;//回车
95 5 enter_flag=1;
96 5 break;
97 5 case 0x44:
98 5 func_index=table[func_index].down;//向下翻
99 5 break;
100 5 default:
101 5 break;
102 5
103 5 }
104 4 }
105 3
106 3 current_operation_index=table[func_index].current_operation;
107 3 if(enter_flag==1){ClearLCD();enter_flag==0;} //如果按了回车则需要清屏
*** WARNING C275 IN LINE 107 OF MENU.C: expression with possibly no effect
108 3 }
109 2
110 2 // fun40();//显示左屏固定信息
111 2 (*current_operation_index)();//执行当前操作函数
112 2 }
113 1
114 1 }
C51 COMPILER V7.07 MENU 02/01/2007 14:22:48 PAGE 3
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 4945 ----
CONSTANT SIZE = 4004 ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = 10 4
IDATA SIZE = ---- ----
BIT SIZE = 4 1
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 2 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -