产品动态
全国统一服务热线:
15382323032
客服QQ:3234659108
手机:15382323032
地址:浙江省杭州市西湖区文一西路830号蒋村商务中心B楼2-8007室
12864液晶屏如何去做多级菜单?
现在很多的工程师在使用12864液晶屏时,都会碰到应该如何做多级菜单的问题,去请教供应商吧,往往是得不到想要的答案的,去问百度吧,又不能够确定答案是否正确,难!今天,我们就请杭州精显的工程师来给您一个12864液晶屏如何做多级菜单的范例。
#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;
}
最新资讯
- 2024-07-05 高亮液晶屏在工业和航空领域的应用
- 2024-07-05 低温环境下工业液晶屏的性能差异分
- 2024-06-25 立煌的LH0255ZJ01条形屏的相关介绍
- 2024-06-14 高温对工业液晶显示屏封装材料的影
- 2024-06-12 京东方MV238FHB-NG0的简介
- 2024-06-12 深入探讨宽屏分辨率的工作原理
- 2024-06-12 深入探讨宽屏分辨率的工作原理
- 2024-06-06 如何选择适合自己的宽屏触摸屏产品
- 2024-06-06 极端环境挑战下超宽温液晶屏的应用
- 2024-06-05 条形屏是如何根据客户的需求来进行