⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 menu.h

📁 真正实现完美应用的以LCD12864为显示终端的四行多级菜单源码(完整版)
💻 H
字号:
/*********************************************************************************************************
*                                           Menu Function's Head
*                                               QiZhao,2007
*                                           All Rights Reserved
* File      : menu.h
* By        : QiZhao
* Contact   : zq1987731@163.com
*
* Version   : V1.3 α
* Corrector : QiZhao
* Date      : 2008.2.1 (Last modified)
*
* Remarks   : Through upward and downward, Enter and cancel four button control
*             of the structure of the multi-level menu subroutine, the subroutine
*             through a dot-matrix LCD display display terminal.
*
*********************************************************************************************************/

    #ifndef   _menu_h_
    #define   _menu_h_

/*********************************************************************************************************
*
*                                Interface and global variables defined
*
*********************************************************************************************************/

    #define MENULEVEL 6         // Now the number of menu List
    #define M_Size 31           // Now the number of menu options

/*********************************************************************************************************
*
*                                            Menu Struction
*
*********************************************************************************************************/

    struct Option
    {
        uchar Key_Lv;           // List of the number of menu
        uchar Enter_Index;      // Options to enter the index
        uchar Cancel_Index;     // Options to cancel the index
        uchar KeyWord[16];      // Menu options textual descriptions
        uchar Word_Size;        // The number of bytes
    };

    struct Option code MENU_LIST[M_Size] =
    {
        { 0,    5,      0,  "Layer1_1",  8},    // 0
        { 0,    15,     1,  "Layer1_2",  8},    // 1
        { 0, M_Size-1,  2,  "Layer1_3",  8},    // 2
        { 0, M_Size-1,  3,  "Layer1_4",  8},    // 3
        { 0, M_Size-1,  4,  "Layer1_5",  8},    // 4
        { 1,    10,     0,  "Layer2_1",  8},    // 5
        { 1, M_Size-1,  0,  "Layer2_2",  8},    // 6
        { 1, M_Size-1,  0,  "Layer2_3",  8},    // 7
        { 1, M_Size-1,  0,  "Layer2_4",  8},    // 8
        { 1, M_Size-1,  0,  "Layer2_5",  8},    // 9
        { 2, M_Size-1,  5,  "Layer3_1",  8},    //10
        { 2, M_Size-1,  5,  "Layer3_2",  8},    //11
        { 2, M_Size-1,  5,  "Layer3_3",  8},    //12
        { 2, M_Size-1,  5,  "Layer3_4",  8},    //13
        { 2, M_Size-1,  5,  "Layer3_5",  8},    //14
        { 3,    20,     1,  "Layer2_6",  8},    //15
        { 3, M_Size-1,  1,  "Layer2_7",  8},    //16
        { 3, M_Size-1,  1,  "Layer2_8",  8},    //17
        { 3, M_Size-1,  1,  "Layer2_9",  8},    //18
        { 3, M_Size-1,  1,  "Layer2_10", 9},    //19
        { 4,    25,     15, "Layer3_6",  8},    //20
        { 4, M_Size-1,  15, "Layer3_7",  8},    //21
        { 4, M_Size-1,  15, "Layer3_8",  8},    //22
        { 4, M_Size-1,  15, "Layer3_9",  8},    //23
        { 4, M_Size-1,  15, "Layer3_10", 9},    //24
        { 5, M_Size-1,  20, "Layer4_1",  8},    //25
        { 5, M_Size-1,  20, "Layer4_2",  8},    //26
        { 5, M_Size-1,  20, "Layer4_3",  8},    //27
        { 5, M_Size-1,  20, "Layer4_4",  8},    //28
        { 5, M_Size-1,  20, "Layer4_5",  8},    //29
        { 0,    0,      0,  "",          0}     //30
    };

/*********************************************************************************************************
*
*                                               Menu Sort
*
*********************************************************************************************************/

    uchar code Level[MENULEVEL][3] =
    {   //Beginning of the end of every form corresponding index number, and the number of options
        {0, 4,  5},
        {5, 9,  5},
        {10,14, 5},
        {15,19, 5},
        {20,24, 5},
        {25,30, 5},
    };

    uchar First_Index  = 0;             // The first line screen display, the index
    uchar Select_Line  = 1;             // The currently selected row
    uchar Select_Index = 0;             // Corresponding to the currently selected index
    uchar Last_Index   = 0;
    // Before entering the indexing function(the use of specific functions judgement)

/*********************************************************************************************************
*
*                                            Function statement
*
*********************************************************************************************************/

    extern void REFRESH_MENU_DIS (void); // Refresh LCD display
    extern void MAIN_MENU (void);        // Calling the main menu

    static bit  MenuLevelStart (void);
    static bit  MenuLevelEnd (void);
    static void MENU_UP (void);
    static void MENU_DOWN (void);
    static void MENU_ENTER (void);
    static void MENU_CANCEL (void);
    static void NoThisFunction (void);

/*********************************************************************************************************
*
*                                              Menu Function
*
*********************************************************************************************************/

    static FUN_1_1 ();
    static FUN_1_2 ();
    static FUN_1_3 ();
    static FUN_2_1 ();
    static FUN_2_2 ();
    static FUN_2_3 ();
    static FUN_2_4 ();
    static FUN_2_5 ();
    static FUN_2_6 ();
    static FUN_2_7 ();
    static FUN_2_8 ();
    static FUN_3_1 ();
    static FUN_3_2 ();
    static FUN_3_3 ();
    static FUN_3_4 ();
    static FUN_3_5 ();
    static FUN_3_6 ();
    static FUN_3_7 ();
    static FUN_3_8 ();
    static FUN_3_9 ();
    static FUN_4_1 ();
    static FUN_4_2 ();
    static FUN_4_3 ();
    static FUN_4_4 ();
    static FUN_4_5 ();

/*********************************************************************************************************
*
*                                            Includes not repeat
*
*********************************************************************************************************/

    #endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -