收藏文章 楼主
版块:工业液晶屏   类型:普通   作者:工业液晶屏   查看:2833   回复:0   获赞:0   时间:2022-01-17 16:25:16

现在很多的工程师在使用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;
}
 


【声明】部分信息来自互联网,力求安全及时、准确无误,目的在于传递更多信息,并不代表对其观点赞同或对其真实性负责。如本网转载信息涉及版权等问题,请及时与本网联系删除。


全站外链: TEC传感器 | 猫掌外链
 
回复列表
默认   热门   正序   倒序

回复:12864液晶屏如何去做多级菜单?

网站公告

近期本站被人为恶意注册及发布垃圾帖,每一个发帖都会经过审核,一经发现违法或垃圾帖的用户,帖子将被删除或封号,请大家共同维护互联网环境,共创美好互联网未来。

详细的发帖规则请阅读:

《小猪外链网发帖规则》

《小猪外链网最新金币规则》

注:本站严禁发布灰色违禁违法内容,如发现立刻永久封号,如开通会员的概不退款。

Powered by 小猪外链网 8.3.15

©2015 - 2025 小猪SEO外链平台

备案号:浙ICP备17015142号

免责申明:本网站内容由平台入驻会员撰写,除创始人账号外,其他观点仅代表作者本人,不代表小猪外链网立场。如果内容涉及侵犯其他公司、团体的利益、请联系小猪SEO外链网客服举证删除

您的IP:52.15.226.19,2025-05-05 19:44:52,Processed in 0.29523 second(s).

各位站长请准守小猪SEO外链网的发帖规则,文明理性发言

外链优化

用户名:

粉丝数:

签名:

资料 关注 好友 消息
分享
已有0次打赏