找回密碼
 立即注冊(cè)

QQ登錄

只需一步,快速開始

搜索
查看: 7022|回復(fù): 10
打印 上一主題 下一主題
收起左側(cè)

單片機(jī)LCD12864無(wú)限擴(kuò)展多級(jí)菜單源碼

  [復(fù)制鏈接]
跳轉(zhuǎn)到指定樓層
樓主
ID:316075 發(fā)表于 2018-4-25 11:34 | 只看該作者 回帖獎(jiǎng)勵(lì) |倒序?yàn)g覽 |閱讀模式
本人弄得 多級(jí)菜單 無(wú)限擴(kuò)展

單片機(jī)源程序如下:
  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)(); //執(zhí)行當(dāng)前顯示函數(shù)
  8. typedef struct
  9.    {
  10.         u8 current;        //當(dāng)前狀態(tài)號(hào)
  11.         u8  up;//向上翻索引號(hào)
  12.         u8 down;//向下翻索引號(hào)
  13.         u8 enter;//確認(rèn)索引號(hào)
  14.         u8 num_ent;//編碼器確認(rèn)鍵
  15.         void (*current_operation)(); //要執(zhí)行的函數(shù)
  16.         } key_table;

  17.          key_table table[21]=
  18. {
  19.   {0,3,1,4,15,(*fun1)},//運(yùn)行狀態(tài)
  20.          {1,0,2,6,1,(*fun2)}, //歷史記錄
  21.         {2,1,3,10,2,(*fun3)},//版本信息
  22.         {3,2,0,11,3,(*fun4)},//功能設(shè)置
  23.         {4,5,5,15,4,(*fun5)},//運(yùn)行參數(shù)
  24.         {5,4,4,0,5,(*fun6)}, //運(yùn)行時(shí)間
  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)},//設(shè)置通訊地址
  31.         {12,11,13,0,3,(*fun13)},//設(shè)置語(yǔ)言
  32.         {13,12,14,0,3,(*fun14)}, //設(shè)置時(shí)間
  33.          {14,13,11,0,3,(*fun15)},//更多
  34.         {15,18,16,0,15,(*fun16)},//主畫面
  35.         {16,15,17,0,15,(*fun17)},//輸入數(shù)據(jù)
  36.         {17,16,18,0,15,(*fun18)}, //輸出數(shù)據(jù)
  37.          {18,17,15,0,15,(*fun19)},//功率參數(shù)
  38.         {19,17,15,0,11,(*fun20)},//通訊地址
  39. };
  40.         
  41.         int main(void)
  42. {
  43.         u8 num;
  44.         SystemInit();                //系統(tǒng)初始化
  45.         delay_init(72);             //延時(shí)初始化
  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;   //確認(rèn)
  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)();//執(zhí)行當(dāng)前操作函數(shù)
  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. …………限于本文篇幅 余下代碼請(qǐng)從51黑下載附件…………
復(fù)制代碼

所有資料51hei提供下載:
DIS12864 - 副本.rar (289.68 KB, 下載次數(shù): 328)


分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏12 分享淘帖 頂 踩
回復(fù)

使用道具 舉報(bào)

沙發(fā)
ID:363677 發(fā)表于 2018-7-3 09:19 | 只看該作者
感謝分享!!!!!!!!
回復(fù)

使用道具 舉報(bào)

板凳
ID:281991 發(fā)表于 2018-9-5 16:47 | 只看該作者
學(xué)習(xí)一下,共同進(jìn)步
回復(fù)

使用道具 舉報(bào)

地板
ID:387860 發(fā)表于 2018-9-8 08:57 | 只看該作者
全都注釋掉了,怎么用
回復(fù)

使用道具 舉報(bào)

5#
ID:285132 發(fā)表于 2018-9-13 23:07 | 只看該作者
學(xué)習(xí)一下
回復(fù)

使用道具 舉報(bào)

6#
ID:402923 發(fā)表于 2018-9-26 22:57 來(lái)自手機(jī) | 只看該作者
哥們最近在做lcd12864手持查詢快遞裝置能發(fā)給我這資料嗎?QQ郵箱3295773665@qq.com
回復(fù)

使用道具 舉報(bào)

7#
ID:96552 發(fā)表于 2019-7-26 14:14 | 只看該作者
程序編譯不能通過(guò)呀,好多錯(cuò)誤
回復(fù)

使用道具 舉報(bào)

8#
ID:96552 發(fā)表于 2019-7-27 20:18 | 只看該作者
終于可以了,版本問(wèn)題
回復(fù)

使用道具 舉報(bào)

9#
ID:18591 發(fā)表于 2019-10-6 18:18 | 只看該作者
學(xué)習(xí)一下,共同進(jìn)步
回復(fù)

使用道具 舉報(bào)

10#
ID:392914 發(fā)表于 2019-11-17 21:18 | 只看該作者
當(dāng)前狀態(tài)號(hào) 是怎么被運(yùn)用的.老是看不懂.
回復(fù)

使用道具 舉報(bào)

11#
ID:870718 發(fā)表于 2021-5-29 11:18 | 只看該作者
不算是一個(gè)成功的菜單程序。
回復(fù)

使用道具 舉報(bào)

本版積分規(guī)則

手機(jī)版|小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術(shù)交流QQ群281945664

Powered by 單片機(jī)教程網(wǎng)

快速回復(fù) 返回頂部 返回列表