标题: 单片机LCD12864无限扩展多级菜单源码 [打印本页]

作者: 何必刻意    时间: 2018-4-25 11:34
标题: 单片机LCD12864无限扩展多级菜单源码
本人弄得 多级菜单 无限扩展

单片机源程序如下:
  1. #include "delay.h"
  2. #include "12864.h"
  3. #include "fun.h"
  4. #include "key.h"
  5. #include "wakeup.h"
  6. u8  func_index=0;

  7. void (*current_operation_index)(); //执行当前显示函数
  8. typedef struct
  9.    {
  10.         u8 current;        //当前状态号
  11.         u8  up;//向上翻索引号
  12.         u8 down;//向下翻索引号
  13.         u8 enter;//确认索引号
  14.         u8 num_ent;//编码器确认键
  15.         void (*current_operation)(); //要执行的函数
  16.         } key_table;

  17.          key_table table[21]=
  18. {
  19.   {0,3,1,4,15,(*fun1)},//运行状态
  20.          {1,0,2,6,1,(*fun2)}, //历史记录
  21.         {2,1,3,10,2,(*fun3)},//版本信息
  22.         {3,2,0,11,3,(*fun4)},//功能设置
  23.         {4,5,5,15,4,(*fun5)},//运行参数
  24.         {5,4,4,0,5,(*fun6)}, //运行时间
  25.          {6,9,7,0,1,(*fun7)},//故障记录
  26.         {7,6,8,0,1,(*fun8)},//7天记录
  27.         {8,7,9,0,1,(*fun9)},//今年记录
  28.         {9,8,6,0,1,(*fun10)}, //往年记录
  29.          {10,0,0,0,2,(*fun11)},//版本信息
  30.         {11,14,12,19,3,(*fun12)},//设置通讯地址
  31.         {12,11,13,0,3,(*fun13)},//设置语言
  32.         {13,12,14,0,3,(*fun14)}, //设置时间
  33.          {14,13,11,0,3,(*fun15)},//更多
  34.         {15,18,16,0,15,(*fun16)},//主画面
  35.         {16,15,17,0,15,(*fun17)},//输入数据
  36.         {17,16,18,0,15,(*fun18)}, //输出数据
  37.          {18,17,15,0,15,(*fun19)},//功率参数
  38.         {19,17,15,0,11,(*fun20)},//通讯地址
  39. };
  40.         
  41.         int main(void)
  42. {
  43.         u8 num;
  44.         SystemInit();                //系统初始化
  45.         delay_init(72);             //延时初始化
  46.         LCD12864_InitPort(); //端口初始化
  47.         LCD12864_Init();         //液晶初始化
  48.   Key_Init();//按键初始化
  49.         
  50.         
  51. //  LCD12864_Pos(3,5);
  52.         LCD12684_Wdat(0x35);

  53.                 while(1)
  54.          {
  55.                  num=KEY_Scan();//得到键值
  56.                 if(num==3)

  57. //                {
  58. //                switch(num)
  59. //                        {
  60. //                                case 1:
  61. //                                func_index=table[func_index].up;  break;  //向上翻
  62. //                                case 2:
  63. //                                func_index=table[func_index].down; break;   //向下翻
  64. //                                case 3:
  65. //                                func_index=table[func_index].enter; break;   //确认
  66. //                                case 4:
  67. //                                func_index=table[func_index].num_ent; break;
  68. //                                }           
  69. //         LCD12864_Clr();    //clear all dots
  70. //                 }                                
  71. //                current_operation_index=table[func_index].current_operation;
  72. //                (*current_operation_index)();//执行当前操作函数
  73. //   }
  74.         {
  75.                  delay_ms(500);
  76.                 Sys_Enter_Standby();
  77.         }
  78.          
  79. //         if(KEY_Scan()==1)
  80. //         {
  81. //                RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR,ENABLE);
  82. //                 
  83. //         
  84. //         
  85. //         
  86. //         
  87. //         }
  88.   }

  89. ……………………

  90. …………限于本文篇幅 余下代码请从51黑下载附件…………
复制代码

所有资料51hei提供下载:
DIS12864 - 副本.rar (289.68 KB, 下载次数: 328)



作者: abrahamqw    时间: 2018-7-3 09:19
感谢分享!!!!!!!!
作者: letter256    时间: 2018-9-5 16:47
学习一下,共同进步
作者: yekai_yh    时间: 2018-9-8 08:57
全都注释掉了,怎么用
作者: antyme    时间: 2018-9-13 23:07
学习一下
作者: complicatedRuby    时间: 2018-9-26 22:57
哥们最近在做lcd12864手持查询快递装置能发给我这资料吗?QQ邮箱3295773665@qq.com
作者: hilam    时间: 2019-7-26 14:14
程序编译不能通过呀,好多错误
作者: hilam    时间: 2019-7-27 20:18
终于可以了,版本问题
作者: jxchen    时间: 2019-10-6 18:18
学习一下,共同进步
作者: ygflsa    时间: 2019-11-17 21:18
当前状态号 是怎么被运用的.老是看不懂.
作者: 放下自在    时间: 2021-5-29 11:18
不算是一个成功的菜单程序。




欢迎光临 (http://www.51hei.com/bbs/) Powered by Discuz! X3.1