1.LCD液晶多级菜单源码
2.STM32+12864实现多级文字菜单的切换
单片机源程序如下:
- /**
- ******************************************************************************
- * @file main.c
- * @author SUNZHENGYUAN
- * @version V1.0
- * @date 2013-xx-xx
- * @brief 工程项目
- ******************************************************************************
- * @attention
- *
- * 项目平台:STM32F103ZET6
- *
- *
- *
- ******************************************************************************
- */
- /*=====================================================================================
- 函数名称:
- 功能描述:
- 全局变量:
- 参数说明:
- 返回说明:
- 设 计 人:
- 版 本:
- 说 明:
- ======================================================================================*/
- #include "stm32f10x.h"
- #include "Param.h"
- #include "GPIO.h"
- #include "Lcd.h"
- #include "function.h"
- uchar func_index=0;
- uchar one=0;
- void (*current_operation_index)();
- typedef struct
- {
- uchar current;
- uchar up;
- uchar down;
- uchar right;
- uchar enter;
- void (*current_operation)();
- } key_table;
-
- key_table tables[Menu_Num]=
- {
- {0,3,1,1,4,(*fun_main_1)},
- {1,0,2,0,1,(*fun_main_2)},
- {2,1,3,3,11,(*fun_main_3)},
- {3,2,0,2,10,(*fun_main_4)},
- {4,9,5,4,4,(*fun_measure_1)},
- {5,4,6,5,5,(*fun_measure_2)},
- {6,5,7,6,6,(*fun_measure_3)},
- {7,6,8,7,7,(*fun_measure_4)},
- {8,7,9,8,0,(*fun_measure_5)},
- {9,8,4,9,9,(*fun_measure_6)},
- {10,0,0,0,0,(*fun_document_1)},
- {11,13,12,16,16,(*fun_enable_1)},
- {12,11,13,0,0,(*fun_enable_2)},
- {13,12,11,14,14,(*fun_enable_3)},
- {14,15,15,13,13,(*fun_enable_4)},
- {15,14,14,13,13,(*fun_enable_5)},
- {16,17,17,11,11,(*fun_enable_6)},
- {17,16,16,11,11,(*fun_enable_7)},
- };
- /**
- * @brief 主函数
- * @param 无
- * @retval 无
- */
- int main(void)
- {
-
- GPIO_Config();
- Lcd_12864_Init();
- Lcd_12864_Clear_AllScreen();
- while(1)
- {
- /*******************find index****************************/
- if((keyup==0)||(keydown==0)||(keyenter==0)||(keyright==0))
- {
- Delay_(10);
- if(keyup==0)
- {
- func_index=tables[func_index].up;
- one=0;
- while(!keyup);
- }
- if(keydown==0)
- {
- func_index=tables[func_index].down;
- one=0;
- while(!keydown);
- }
- if(keyenter==0)
- {
- func_index=tables[func_index].enter;
- one=0;
- while(!keyenter);
- }
- if(keyright==0)
- {
- func_index=tables[func_index].right;
- one=0;
- while(!keyright);
- }
-
- }
-
- if(one==0)
- {
-
- // Lcd_12864_Clear_AllScreen();
- // Lcd_12864_Init();
- current_operation_index=tables[func_index].current_operation;
- (*current_operation_index)();
- one=1;
- }
- }
- }
- /*********************************************END OF FILE**********************/
复制代码
全部资料51hei下载地址:
液晶多级菜单.zip
(1.78 MB, 下载次数: 277)
|