专家
公告
财富商城
电子网
旗下网站
首页
问题库
专栏
标签库
话题
专家
NEW
门户
发布
提问题
发文章
我想用12864液晶屏做菜单,但是不知道菜单怎么做?
2019-03-24 19:10
发布
×
打开微信“扫一扫”,打开网页后点击屏幕右上角分享按钮
站内问答
/
51单片机
5736
3
1674
我想用12864液晶屏做菜单,但是不知道菜单怎么做。以前我做文字的时候就直接打字的但是现在要做菜单了,就不知道怎么打字了,也不知道什么步骤,谁有相关的视频啊,自己 能告诉我下的也好谢谢了,我想自己学习 此帖出自
小平头技术问答
友情提示:
此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
3条回答
Li_Lei
2019-03-24 23:47
以前做过很复杂的菜单,不过不是51的
#include "menu_level1.h"
#include "./Driver/key/key.h"
#include "./Driver/SysInterrupt/SetInterruptStatus.h"
#include "./Driver/LCD12864/ms12864r.h"
#include "./Driver/LCD12864/menu_function.h"
#include "haitun.h"
#include "aaa.h"
//全局变量引入
extern unsigned int menu_list_roll_choice;
extern unsigned int TimeBase128;
const unsigned int hand_bmp1[16]= //手型字符
{
0x0000, 0x0180, 0x0360, 0x0550, 0x0558, 0x0554, 0x0554, 0x7554,
0x4d54, 0x2404, 0x1004, 0x1004, 0x0804, 0x0408, 0x03f8, 0x07f8
};
const unsigned int hand_bmp2[16]= //手型字符
{
0x0000, 0x0400, 0x0a00, 0x0a00, 0x0b50, 0x0aa8, 0x0aa8, 0x1aa8,
0x2aa8, 0x2808, 0x2808, 0x2008, 0x1008, 0x0808, 0x07f0, 0x0ff0
};
//菜单数组
const unsigned int menu_1_0[7][16] = //一级菜单
{
{"1.字符显示演示 "},
{"2.数据显示演示 "},
{"3.光标闪烁开关 "},
{"4.图形显示演示 "},
{"5.动画演示 "},
{"6.点画图形 "},
{"7.版本信息.. "}
};
const unsigned int menu_1_1[2][16] =
{
{"1.字符显示演示 "},
{"enter 键返回 "}
};
const unsigned int menu_1_2[2][16] =
{
{"2.数据显示演示 "},
{"+,-,enter返回 "}
};
const unsigned int menu_1_3[1][16] =
{
{"3.光标闪烁开关 "},
};
const unsigned int menu_1_4[2][16] =
{
{"4.图形显示演示 "},
{"+,-,enter 返回 "}
};
const unsigned int menu_1_5[0][16] =
{
};
const unsigned int menu_1_6[1][16] =
{
{"6.点画图形 "},
};
const unsigned int menu_1_7[4][16] =
{
{" 液晶演示程序 "},
{" Version 1.0 "},
{" 制作人: 虎子 "},
{" 按enter:返回 "}
};
const unsigned int menu_1_end[]={}; //此项用于计算用
//菜单字符数组
const unsigned int *menu_level1_address_array[]= {
(unsigned int*)menu_1_0,(unsigned int*)menu_1_1,(unsigned int*)menu_1_2,(unsigned int*)menu_1_3,
(unsigned int*)menu_1_4,(unsigned int*)menu_1_5,(unsigned int*)menu_1_6,(unsigned int*)menu_1_7,
(unsigned int*)menu_1_end
};
//菜单处理函数,与菜单字符数组一一对应
const menu_function menu_level1_dispose_array[]={
menu_1_0_fun,menu_1_1_fun,menu_1_2_fun,menu_1_3_fun,
menu_1_4_fun,menu_1_5_fun,menu_1_6_fun,
menu_1_7_fun
//下一级菜单入口函数
};
//-------------以下是菜单处理函数-------------------------------
void menu_1_0_fun(void)//本级菜单初始化
{
menu_init((unsigned int *)hand_bmp1);
menu_addr_array=(unsigned int **)menu_level1_address_array;
menu_dispose_array=(menu_function *)menu_level1_dispose_array;
menu_list_display();
while(1)
{
*P_Watchdog_Clear = C_WDTCLR;
switch(Key_Get())
{
case KEY_1://enter press
menu_chg_windows(); //本级菜单窗口切换
break;
case KEY_2://+ key press
menu_down_roll();
break;
case KEY_3://- key press
menu_up_roll();
break;
}
}
}
void menu_1_1_fun(void)
{
LCD_disp_string(8,(unsigned int *)"lcd 显示字符");
while (1) {
switch(Key_Get())
{
case 1: //press enter
return;
case 2://+ key press
break;
case 4://- key press
break;
}//switch end
LCD_disp_char(24,TimeBase128); //显示一个汉字字符
*P_Watchdog_Clear = C_WDTCLR;
}//while end
}
void menu_1_2_fun(void)
{
unsigned int tmp=0;
while (1) {
*P_Watchdog_Clear = C_WDTCLR;
switch(Key_Get())
{
case 1:
return;
break;
case 2://+ key press
LCD_Set_Mask_bit(tmp++);
LCD_disp_string(8,(unsigned int *)" ");
LCD_disp_string(24,(unsigned int *)" ");
break;
case 4://- key press
LCD_Set_Mask_bit(tmp--);
LCD_disp_string(8,(unsigned int *)" ");
LCD_disp_string(24,(unsigned int *)" ");
break;
}//switch end
//十进制显示无符号整数数值
LCD_disp_dec_uint(8,TimeBase128);
//十六进制显示整数数值
LCD_disp_hex_uint(11,TimeBase128);
//十进制显示有符号整数数值
LCD_disp_dec_int(13,(int)TimeBase128);
//十六进制显示32位整数数值
LCD_disp_hex_lint(24,(unsigned long int)TimeBase128);
}//while end
}
unsigned int flag=1;
void menu_1_3_fun(void)
{
if (flag)
{
LCD_Cursor_Blink_ON();
flag=0;
}
else
{
LCD_Cursor_Blink_OFF();
flag=1;
}
}
void menu_1_4_fun(void)
{
unsigned int x=0,y=32;
LCD_disp_word_picture(x,y,(unsigned int *)encoding_000);
while (1) {
*P_Watchdog_Clear = C_WDTCLR;
switch(Key_Get())
{
case 1:
LCD_disp_word_picture(x,y,(unsigned int *)encoding_001);
return;
case 2://+ key press
LCD_disp_word_picture(x,y,(unsigned int *)encoding_001);
x+=16;
LCD_disp_word_picture(x,y,(unsigned int *)encoding_000);
break;
case 4://- key press
LCD_disp_word_picture(x,y,(unsigned int *)encoding_001);
y+=1;
LCD_disp_word_picture(x,y,(unsigned int *)encoding_000);
break;
default:
break;
}//switch end
}//while end
}
void menu_1_5_fun(void)
{
unsigned int time=TimeBase128;
while (TimeBase128<time+5*128) //持续5秒钟
{
LCD_disp_full_screen((unsigned int *)encoding_02);*P_Watchdog_Clear = C_WDTCLR;
LCD_disp_full_screen((unsigned int *)encoding_03);*P_Watchdog_Clear = C_WDTCLR;
LCD_disp_full_screen((unsigned int *)encoding_04);*P_Watchdog_Clear = C_WDTCLR;
LCD_disp_full_screen((unsigned int *)encoding_05);*P_Watchdog_Clear = C_WDTCLR;
LCD_disp_full_screen((unsigned int *)encoding_06);*P_Watchdog_Clear = C_WDTCLR;
LCD_disp_full_screen((unsigned int *)encoding_07);*P_Watchdog_Clear = C_WDTCLR;
LCD_disp_full_screen((unsigned int *)encoding_08);*P_Watchdog_Clear = C_WDTCLR;
LCD_disp_full_screen((unsigned int *)encoding_00);*P_Watchdog_Clear = C_WDTCLR;
LCD_disp_full_screen((unsigned int *)encoding_01);*P_Watchdog_Clear = C_WDTCLR;
}
LCD_clear_screen(); //清屏
}
void menu_1_6_fun(void)
{
LCD_disp_string(8,(unsigned int *)"此版本不支持..");
*P_Watchdog_Clear = C_WDTCLR;
while(Key_Get()!=1);
return;
}
void menu_1_7_fun(void)
{
*P_Watchdog_Clear = C_WDTCLR;
while(Key_Get()!=1);
return;
}
加载中...
查看其它3个回答
一周热门
更多
>
相关问题
相关文章
基于51单片机的计算器设计
0个评论
51单片机300个proteus仿真实例下载
0个评论
51单片机 蜂鸣器
0个评论
51单片机驱动RC522模块
0个评论
基于51单片机的指纹密码锁
0个评论
AT89C51单片机制作简易密码锁
0个评论
51单片机汇编语言计数器
0个评论
51单片机精确延时设计
0个评论
×
关闭
采纳回答
向帮助了您的知道网友说句感谢的话吧!
非常感谢!
确 认
×
关闭
编辑标签
最多设置5个标签!
保存
关闭
×
关闭
举报内容
检举类型
检举内容
检举用户
检举原因
广告推广
恶意灌水
回答内容与提问无关
抄袭答案
其他
检举说明(必填)
提交
关闭
×
打开微信“扫一扫”,打开网页后点击屏幕右上角分享按钮
×
付费偷看金额在0.1-10元之间
确定
×
关闭
您已邀请
0
人回答
查看邀请
擅长该话题的人
回答过该话题的人
我关注的人
#include "menu_level1.h"
#include "./Driver/key/key.h"
#include "./Driver/SysInterrupt/SetInterruptStatus.h"
#include "./Driver/LCD12864/ms12864r.h"
#include "./Driver/LCD12864/menu_function.h"
#include "haitun.h"
#include "aaa.h"
//全局变量引入
extern unsigned int menu_list_roll_choice;
extern unsigned int TimeBase128;
const unsigned int hand_bmp1[16]= //手型字符
{
0x0000, 0x0180, 0x0360, 0x0550, 0x0558, 0x0554, 0x0554, 0x7554,
0x4d54, 0x2404, 0x1004, 0x1004, 0x0804, 0x0408, 0x03f8, 0x07f8
};
const unsigned int hand_bmp2[16]= //手型字符
{
0x0000, 0x0400, 0x0a00, 0x0a00, 0x0b50, 0x0aa8, 0x0aa8, 0x1aa8,
0x2aa8, 0x2808, 0x2808, 0x2008, 0x1008, 0x0808, 0x07f0, 0x0ff0
};
//菜单数组
const unsigned int menu_1_0[7][16] = //一级菜单
{
{"1.字符显示演示 "},
{"2.数据显示演示 "},
{"3.光标闪烁开关 "},
{"4.图形显示演示 "},
{"5.动画演示 "},
{"6.点画图形 "},
{"7.版本信息.. "}
};
const unsigned int menu_1_1[2][16] =
{
{"1.字符显示演示 "},
{"enter 键返回 "}
};
const unsigned int menu_1_2[2][16] =
{
{"2.数据显示演示 "},
{"+,-,enter返回 "}
};
const unsigned int menu_1_3[1][16] =
{
{"3.光标闪烁开关 "},
};
const unsigned int menu_1_4[2][16] =
{
{"4.图形显示演示 "},
{"+,-,enter 返回 "}
};
const unsigned int menu_1_5[0][16] =
{
};
const unsigned int menu_1_6[1][16] =
{
{"6.点画图形 "},
};
const unsigned int menu_1_7[4][16] =
{
{" 液晶演示程序 "},
{" Version 1.0 "},
{" 制作人: 虎子 "},
{" 按enter:返回 "}
};
const unsigned int menu_1_end[]={}; //此项用于计算用
//菜单字符数组
const unsigned int *menu_level1_address_array[]= {
(unsigned int*)menu_1_0,(unsigned int*)menu_1_1,(unsigned int*)menu_1_2,(unsigned int*)menu_1_3,
(unsigned int*)menu_1_4,(unsigned int*)menu_1_5,(unsigned int*)menu_1_6,(unsigned int*)menu_1_7,
(unsigned int*)menu_1_end
};
//菜单处理函数,与菜单字符数组一一对应
const menu_function menu_level1_dispose_array[]={
menu_1_0_fun,menu_1_1_fun,menu_1_2_fun,menu_1_3_fun,
menu_1_4_fun,menu_1_5_fun,menu_1_6_fun,
menu_1_7_fun
//下一级菜单入口函数
};
//-------------以下是菜单处理函数-------------------------------
void menu_1_0_fun(void)//本级菜单初始化
{
menu_init((unsigned int *)hand_bmp1);
menu_addr_array=(unsigned int **)menu_level1_address_array;
menu_dispose_array=(menu_function *)menu_level1_dispose_array;
menu_list_display();
while(1)
{
*P_Watchdog_Clear = C_WDTCLR;
switch(Key_Get())
{
case KEY_1://enter press
menu_chg_windows(); //本级菜单窗口切换
break;
case KEY_2://+ key press
menu_down_roll();
break;
case KEY_3://- key press
menu_up_roll();
break;
}
}
}
void menu_1_1_fun(void)
{
LCD_disp_string(8,(unsigned int *)"lcd 显示字符");
while (1) {
switch(Key_Get())
{
case 1: //press enter
return;
case 2://+ key press
break;
case 4://- key press
break;
}//switch end
LCD_disp_char(24,TimeBase128); //显示一个汉字字符
*P_Watchdog_Clear = C_WDTCLR;
}//while end
}
void menu_1_2_fun(void)
{
unsigned int tmp=0;
while (1) {
*P_Watchdog_Clear = C_WDTCLR;
switch(Key_Get())
{
case 1:
return;
break;
case 2://+ key press
LCD_Set_Mask_bit(tmp++);
LCD_disp_string(8,(unsigned int *)" ");
LCD_disp_string(24,(unsigned int *)" ");
break;
case 4://- key press
LCD_Set_Mask_bit(tmp--);
LCD_disp_string(8,(unsigned int *)" ");
LCD_disp_string(24,(unsigned int *)" ");
break;
}//switch end
//十进制显示无符号整数数值
LCD_disp_dec_uint(8,TimeBase128);
//十六进制显示整数数值
LCD_disp_hex_uint(11,TimeBase128);
//十进制显示有符号整数数值
LCD_disp_dec_int(13,(int)TimeBase128);
//十六进制显示32位整数数值
LCD_disp_hex_lint(24,(unsigned long int)TimeBase128);
}//while end
}
unsigned int flag=1;
void menu_1_3_fun(void)
{
if (flag)
{
LCD_Cursor_Blink_ON();
flag=0;
}
else
{
LCD_Cursor_Blink_OFF();
flag=1;
}
}
void menu_1_4_fun(void)
{
unsigned int x=0,y=32;
LCD_disp_word_picture(x,y,(unsigned int *)encoding_000);
while (1) {
*P_Watchdog_Clear = C_WDTCLR;
switch(Key_Get())
{
case 1:
LCD_disp_word_picture(x,y,(unsigned int *)encoding_001);
return;
case 2://+ key press
LCD_disp_word_picture(x,y,(unsigned int *)encoding_001);
x+=16;
LCD_disp_word_picture(x,y,(unsigned int *)encoding_000);
break;
case 4://- key press
LCD_disp_word_picture(x,y,(unsigned int *)encoding_001);
y+=1;
LCD_disp_word_picture(x,y,(unsigned int *)encoding_000);
break;
default:
break;
}//switch end
}//while end
}
void menu_1_5_fun(void)
{
unsigned int time=TimeBase128;
while (TimeBase128<time+5*128) //持续5秒钟
{
LCD_disp_full_screen((unsigned int *)encoding_02);*P_Watchdog_Clear = C_WDTCLR;
LCD_disp_full_screen((unsigned int *)encoding_03);*P_Watchdog_Clear = C_WDTCLR;
LCD_disp_full_screen((unsigned int *)encoding_04);*P_Watchdog_Clear = C_WDTCLR;
LCD_disp_full_screen((unsigned int *)encoding_05);*P_Watchdog_Clear = C_WDTCLR;
LCD_disp_full_screen((unsigned int *)encoding_06);*P_Watchdog_Clear = C_WDTCLR;
LCD_disp_full_screen((unsigned int *)encoding_07);*P_Watchdog_Clear = C_WDTCLR;
LCD_disp_full_screen((unsigned int *)encoding_08);*P_Watchdog_Clear = C_WDTCLR;
LCD_disp_full_screen((unsigned int *)encoding_00);*P_Watchdog_Clear = C_WDTCLR;
LCD_disp_full_screen((unsigned int *)encoding_01);*P_Watchdog_Clear = C_WDTCLR;
}
LCD_clear_screen(); //清屏
}
void menu_1_6_fun(void)
{
LCD_disp_string(8,(unsigned int *)"此版本不支持..");
*P_Watchdog_Clear = C_WDTCLR;
while(Key_Get()!=1);
return;
}
void menu_1_7_fun(void)
{
*P_Watchdog_Clear = C_WDTCLR;
while(Key_Get()!=1);
return;
}
一周热门 更多>