找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 4840|回复: 12
打印 上一主题 下一主题
收起左侧

STM32F103ZET6 LCD12864液晶多级菜单源码

  [复制链接]
跳转到指定楼层
楼主
ID:382993 发表于 2018-8-4 23:18 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
1.LCD液晶多级菜单源码
2.STM32+12864实现多级文字菜单的切换

单片机源程序如下:
  1. /**
  2.   ******************************************************************************
  3.   * @file    main.c
  4.   * @author  SUNZHENGYUAN
  5.   * @version V1.0
  6.   * @date    2013-xx-xx
  7.   * @brief   工程项目
  8.   ******************************************************************************
  9.   * @attention
  10.   *
  11.   * 项目平台:STM32F103ZET6
  12.   *
  13.   *
  14.   *
  15.   ******************************************************************************
  16.   */
  17.   /*=====================================================================================
  18. 函数名称:
  19. 功能描述:
  20. 全局变量:
  21. 参数说明:
  22. 返回说明:
  23. 设 计 人:
  24. 版    本:
  25. 说    明:
  26. ======================================================================================*/
  27. #include "stm32f10x.h"
  28. #include "Param.h"
  29. #include "GPIO.h"
  30. #include "Lcd.h"
  31. #include "function.h"
  32. uchar func_index=0;
  33. uchar one=0;
  34. void (*current_operation_index)();

  35. typedef struct
  36.    {
  37.          uchar current;
  38.          uchar up;
  39.          uchar down;       
  40.                                  uchar right;                 
  41.          uchar enter;                               
  42.          void (*current_operation)();
  43.    } key_table;

  44.          
  45.         key_table tables[Menu_Num]=
  46. {
  47.         {0,3,1,1,4,(*fun_main_1)},
  48.         {1,0,2,0,1,(*fun_main_2)},
  49.         {2,1,3,3,11,(*fun_main_3)},
  50.         {3,2,0,2,10,(*fun_main_4)},
  51.         {4,9,5,4,4,(*fun_measure_1)},
  52.         {5,4,6,5,5,(*fun_measure_2)},
  53.         {6,5,7,6,6,(*fun_measure_3)},
  54.         {7,6,8,7,7,(*fun_measure_4)},
  55.         {8,7,9,8,0,(*fun_measure_5)},
  56.         {9,8,4,9,9,(*fun_measure_6)},
  57.         {10,0,0,0,0,(*fun_document_1)},
  58.         {11,13,12,16,16,(*fun_enable_1)},
  59.         {12,11,13,0,0,(*fun_enable_2)},
  60.         {13,12,11,14,14,(*fun_enable_3)},
  61.         {14,15,15,13,13,(*fun_enable_4)},
  62.         {15,14,14,13,13,(*fun_enable_5)},
  63.         {16,17,17,11,11,(*fun_enable_6)},
  64.         {17,16,16,11,11,(*fun_enable_7)},
  65. };
  66. /**
  67.   * @brief  主函数
  68.   * @param  无
  69.   * @retval 无
  70.   */
  71. int main(void)
  72. {
  73.             
  74.         GPIO_Config();
  75.         Lcd_12864_Init();
  76.         Lcd_12864_Clear_AllScreen();
  77.          while(1)
  78.    {     
  79.          /*******************find index****************************/
  80.                         if((keyup==0)||(keydown==0)||(keyenter==0)||(keyright==0))
  81.                         {
  82.                                  Delay_(10);
  83.                                  if(keyup==0)
  84.                                  {
  85.                                  func_index=tables[func_index].up;  
  86.                                         one=0;
  87.                                  while(!keyup);
  88.                                  }
  89.                                  if(keydown==0)
  90.                                  {
  91.                                  func_index=tables[func_index].down;
  92.                                         one=0;
  93.                                  while(!keydown);
  94.                                  }
  95.                                  if(keyenter==0)
  96.                                  {
  97.                                  func_index=tables[func_index].enter;   
  98.                                         one=0;
  99.                                  while(!keyenter);
  100.                                  }
  101.                                  if(keyright==0)
  102.                                  {
  103.                                  func_index=tables[func_index].right;   
  104.                                         one=0;
  105.                                  while(!keyright);
  106.                                  }
  107.                                                        
  108.                  }                                    
  109.                  
  110.                  if(one==0)
  111.                  {
  112.                          
  113.                 //        Lcd_12864_Clear_AllScreen();
  114.                 //        Lcd_12864_Init();
  115.                         current_operation_index=tables[func_index].current_operation;
  116.                         (*current_operation_index)();
  117.                          one=1;
  118.                  }
  119.    }
  120. }

  121. /*********************************************END OF FILE**********************/
复制代码

全部资料51hei下载地址:
液晶多级菜单.zip (1.78 MB, 下载次数: 276)


分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏6 分享淘帖 顶 踩
回复

使用道具 举报

沙发
ID:224700 发表于 2018-8-15 22:57 | 只看该作者
我一事不明,就代码中的LCD_CS和LCD_RS,前者是12864的片选,那后这是模拟IIC的吗?
回复

使用道具 举报

板凳
ID:224700 发表于 2018-8-15 22:58 | 只看该作者
代码中的LCD_RS和LCD_CS分别是指? 
回复

使用道具 举报

地板
ID:405372 发表于 2018-11-5 14:15 | 只看该作者
学习了学习了
回复

使用道具 举报

5#
ID:405123 发表于 2018-11-28 11:00 | 只看该作者
楼主可以给个插线方法吗
回复

使用道具 举报

6#
ID:290892 发表于 2018-12-10 22:19 | 只看该作者
感谢楼主,学习了
回复

使用道具 举报

7#
ID:419107 发表于 2018-12-11 10:59 | 只看该作者
谢楼主分享,学习一下。
回复

使用道具 举报

8#
ID:450661 发表于 2018-12-20 13:18 | 只看该作者
学习了,谢谢楼主
回复

使用道具 举报

9#
ID:450661 发表于 2018-12-20 19:51 | 只看该作者
打不开老铁
回复

使用道具 举报

10#
ID:492516 发表于 2019-7-21 15:07 | 只看该作者

我一事不明,就代码中的LCD_CS和LCD_RS,前者是12864的片选,那后这是模拟IIC的吗?



回复

使用道具 举报

11#
ID:306573 发表于 2019-10-16 14:59 | 只看该作者
下载学习下。
回复

使用道具 举报

12#
ID:405123 发表于 2019-12-3 19:26 | 只看该作者
我想问下key_table tables[Menu_Num]=里的5个数字是怎么确定的啊
回复

使用道具 举报

13#
ID:691681 发表于 2020-2-12 00:25 | 只看该作者
本帖最后由 ywjianghu 于 2020-2-12 21:58 编辑

不知什么原因,不能解压。今天换了个解压软件,可以了。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

快速回复 返回顶部 返回列表