标题:
单片机LCD12864无限扩展多级菜单源码
[打印本页]
作者:
何必刻意
时间:
2018-4-25 11:34
标题:
单片机LCD12864无限扩展多级菜单源码
本人弄得 多级菜单 无限扩展
单片机源程序如下:
#include "delay.h"
#include "12864.h"
#include "fun.h"
#include "key.h"
#include "wakeup.h"
u8 func_index=0;
void (*current_operation_index)(); //执行当前显示函数
typedef struct
{
u8 current; //当前状态号
u8 up;//向上翻索引号
u8 down;//向下翻索引号
u8 enter;//确认索引号
u8 num_ent;//编码器确认键
void (*current_operation)(); //要执行的函数
} key_table;
key_table table[21]=
{
{0,3,1,4,15,(*fun1)},//运行状态
{1,0,2,6,1,(*fun2)}, //历史记录
{2,1,3,10,2,(*fun3)},//版本信息
{3,2,0,11,3,(*fun4)},//功能设置
{4,5,5,15,4,(*fun5)},//运行参数
{5,4,4,0,5,(*fun6)}, //运行时间
{6,9,7,0,1,(*fun7)},//故障记录
{7,6,8,0,1,(*fun8)},//7天记录
{8,7,9,0,1,(*fun9)},//今年记录
{9,8,6,0,1,(*fun10)}, //往年记录
{10,0,0,0,2,(*fun11)},//版本信息
{11,14,12,19,3,(*fun12)},//设置通讯地址
{12,11,13,0,3,(*fun13)},//设置语言
{13,12,14,0,3,(*fun14)}, //设置时间
{14,13,11,0,3,(*fun15)},//更多
{15,18,16,0,15,(*fun16)},//主画面
{16,15,17,0,15,(*fun17)},//输入数据
{17,16,18,0,15,(*fun18)}, //输出数据
{18,17,15,0,15,(*fun19)},//功率参数
{19,17,15,0,11,(*fun20)},//通讯地址
};
int main(void)
{
u8 num;
SystemInit(); //系统初始化
delay_init(72); //延时初始化
LCD12864_InitPort(); //端口初始化
LCD12864_Init(); //液晶初始化
Key_Init();//按键初始化
// LCD12864_Pos(3,5);
LCD12684_Wdat(0x35);
while(1)
{
num=KEY_Scan();//得到键值
if(num==3)
// {
// switch(num)
// {
// case 1:
// func_index=table[func_index].up; break; //向上翻
// case 2:
// func_index=table[func_index].down; break; //向下翻
// case 3:
// func_index=table[func_index].enter; break; //确认
// case 4:
// func_index=table[func_index].num_ent; break;
// }
// LCD12864_Clr(); //clear all dots
// }
// current_operation_index=table[func_index].current_operation;
// (*current_operation_index)();//执行当前操作函数
// }
{
delay_ms(500);
Sys_Enter_Standby();
}
// if(KEY_Scan()==1)
// {
// RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR,ENABLE);
//
//
//
//
//
// }
}
……………………
…………限于本文篇幅 余下代码请从51黑下载附件…………
复制代码
所有资料51hei提供下载:
DIS12864 - 副本.rar
(289.68 KB, 下载次数: 328)
2018-4-25 17:56 上传
点击文件名下载附件
好
下载积分: 黑币 -5
作者:
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