原创 LCD图形显示_菜单管理_PCF8583_TWI_SPI所有C代码公开

2008-5-11 16:30 2654 5 5 分类: MCU/ 嵌入式
现将2006在一家公司做的一个产品的仿真部分所有源码资料公布,供大家学习和参考!包括参菜单管理算法。菜单翻页可像手机菜单一下,可滚动翻页,并有进度条指示。另还有TWI读写PCF8563的程序。不多说大家看看就知道。以前只公布过protues和hex,反映还可以。今天是源码也公布,希望对大家有帮助。传播请注明作者及出处,谢谢!

图示效果一

点击看大图
 (原文件名:效果_1.png) 

图示效果二

点击看大图
 (原文件名:效果_2.png) 

使用手册截图

点击看大图
 (原文件名:手册.PNG) 


点击看大图
 (原文件名:2.PNG) 


所有资料打包
点击此处下载 ourdev_274225.rar(文件大小:1.05M) (原文件名:debug.rar) 

资料包文件目录
E:\debug>tree /f
卷 WORK 的文件夹 PATH 列表
卷序列号码为 000007BC E4BD:002B
E:.
│  效果_1.png
│  效果_2.png
│  效果_1.jpg
│  效果_2.jpg
│  使用手册V1_0.pdf

├─source
│      Main.h
│      Display.c
│      DotLib.c
│      SPI.h
│      SPI.c
│      Display.h
│      Dotlib.h
│      TWI.h
│      PCF8563.c
│      PCF8563.h
│      TWI.c
│      Includes.h
│      Main.c

└─protues
        LCDBoard.DSN
        Debug.cof
        Debug.hex
        LCDBoard.PWI


程序中的菜单架构提取出来,让大家查看更直观。

/* 菜单架构 */
typedef struct
{
        INT8U KeyTab_MenuIndex;                                                         // 当前状态索引号
        INT8U KeyTab_MaxItems;                                                               // 本级菜单最大条目数
    INT8U KeyTab_PressOk;                                                                // 按下"回车"键时转向的状态索引号
    INT8U KeyTab_PressEsc;                                                               // 按下"返回"键时转向的状态索引号
    INT8U KeyTab_PressDown;                                                              // 按下"向下"键时转向的状态索引号
    INT8U KeyTab_PressUp;                                                            // 按下"向上"键时转向的状态索引号
    void (*CurrentOperate)( void );                                                    // 当前状态应该执行的功能操作
}KeyTabStruct;
void ( *KeyFuncPtr )( void );                                                          // 按键功能指针
/*--------------------------------显示菜单(字库)----------------------------*/
INT8U *TestFace[3]={
        "测试中",                                                                                                                                
        "当前端口",                
        "接触电流"        
};
INT8U *Power[3]={
        "设定电压",                                                                                                                                
        "当前电压",                                                                                                                                
        "工作电流"                                                                                                                                
};
INT8U *MenuRoot[5]={                                                                                                                                
           "一设备类型",                                                                                                                                
        "二端口设定",                                                                                                                                
        "三参数设置",                                                                                                                                
        "四系统设定",                                                                                                                                
        "五关闭系统"                                                                                                                                
};
INT8U MenuRootID[5]={EUTtype,PortSet,Paramete,SystemSet,ShutOff};
INT8U *MenuEutTpye[4] ={
        "壹类",                                                                                                                                         
        "贰类",                                                                   
        "接地",                                                                                                                                         
        "不接地"                                                                                                                                         
};
INT8U MenuPortID[9] ={Port0,Port1,Port2,Port3,Port4,Port5,Port6,Port7,Port8};
INT8U *MenuParam[4] ={
        "电源电压",                                                                                                                                
        "测试时间",                                                                                                                                
        "间隔时间",
        "外部采样"
};
INT8U MenuParamID[4] ={Voltage,Testtime,Spacetime,Exterior};
INT8U *MenuSystem[3] ={
        "时间设定",                                                                                                                                 
        "背光设定",                                                                                                                                
        "键音设定"                                                                                                                                
};
INT8U MenuSystemID[3] ={Time,Backlight,Buzzer};
INT8U *MenuBackLight[2] ={
        "绿光",                                                                                                                                                                                         
        "红光"                                                                                                                                        
};
INT8U MenuBackLightID[2] ={Green,Red};
INT8U *Adjust[1]={
        "校正因子"
};
INT8U*Msg[7] = {
        "启动中…",                                                                                                                                        
        "关机中…",                                                                                                                                
        "已保存!",
        "电源电压不稳",                                                                                                                                        
        "请稍等!",
        "合格",        
        "不合格!"                
};
/*-----------------------------------按键架构---------------------------------*/ 
/*CurMenuID           = 本菜单ID
  MaxMenuItem         = 同级菜单最大项数
  OkMenuID                  = 子菜单层所对应的菜单ID,ID=255为菜单已经到底了
  EscMenuID           = 父菜单层所对应的菜单ID,ID=255为菜单已经到顶了
  DownMenuID          = 弟菜单层所对应的菜单ID,ID=255为菜单是独生子
  UpMenuID            = 兄菜单层所对应的菜单ID,ID=255为菜单是独生子
  CurFunction         = 本菜单所对应的菜单函数指针                                  */                                                  
KeyTabStruct KeyTab[MAX_KEYTABSTRUCT_NUM]={
/* CurID   Max  Ok          Esc         Down        Up         CurFunction    */  
{FACE,      0,        Menu,       Menu,            255,            255,          *FunctionNul     },
{Menu,                5,        EUTtype,    FACE,            PortSet,        ShutOff,  *FunctionNul     },
{EUTtype,        2,        I_type,         Menu,            PortSet,        ShutOff,  *FunctionNul     },
{I_type,        0,        255,                 EUTtype,        II_type,        II_type,  *Function_I            },
{II_type,        0,        255,                EUTtype,        I_type,     I_type,   *Function_II           },
{PortSet,        9,        Port0,             Menu,            Paramete,   EUTtype,  *FunctionNul     },
{Port0,            0,        255,                 PortSet,        Port1,            Port8,           *Function_Port   },
{Port1,            0,        255,                 PortSet,        Port2,            Port0,           *Function_Port   },
{Port2,            0,        255,                 PortSet,        Port3,            Port1,           *Function_Port   },
{Port3,            0,        255,                 PortSet,        Port4,            Port2,           *Function_Port   },
{Port4,         0,        255,                 PortSet,        Port5,            Port3,           *Function_Port   },
{Port5,            0,        255,                 PortSet,        Port6,            Port4,           *Function_Port   },
{Port6,            0,        255,                 PortSet,        Port7,            Port5,           *Function_Port   },
{Port7,            0,        255,                 PortSet,        Port8,            Port6,           *Function_Port   },
{Port8,         0,        255,                 PortSet,        Port0,            Port7,           *Function_Port   },
{Paramete,        3,        Voltage,        Menu,                SystemSet,        PortSet,  *FunctionNul     },
{Voltage,        0,        255,             Paramete,        Testtime,   Exterior, *Function_Paramet},
{Testtime,        0,        255,             Paramete,        Spacetime,  Voltage,  *Function_Paramet},
{Spacetime,        0,        255,             Paramete,        Exterior,   Testtime, *Function_Paramet},
{Exterior,        0,        255,             Paramete,        Voltage,    Spacetime,*Function_Paramet},
{SystemSet,        3,        Time,            Menu,                ShutOff,    Paramete, *Function_System },
{Time,            7,        Year,            SystemSet,        Backlight,        Buzzer,   *FunctionNul     },
{Year,            0,        255,            Time,            Month,            Second,   *Function_Time   },
{Month,            0,        255,            Time,            Day,            Year,     *Function_Time   },
{Day,            0,        255,            Time,            Week,            Month,    *Function_Time   },
{Week,            0,        255,            Time,            Hour,            Day,      *Function_Time   },
{Hour,            0,        255,            Time,            Minute,            Week,     *Function_Time   },
{Minute,        0,        255,            Time,            Second,            Hour,     *Function_Time   },
{Second,    0,        255,            Time,            Year,            Minute,   *Function_Time   },
{Backlight,        2,        Green,                 SystemSet,        Buzzer,            Time,           *FunctionNul     },
{Green,            0,        255,        Backlight,  Red,        Red,          *Function_BkLight},
{Red,           0,        255,            Backlight,        Green,            Green,    *Function_BkLight},
{Buzzer,        2,        Open,                 SystemSet,        Time,            Backlight,*FunctionNul     },
{Open,            0,        255,             Buzzer,     Close,      Close,          *Function_Open   },
{Close,            0,        255,            Buzzer,         Open,            Open,     *Function_Close  },
{ShutOff,        0,        255,            Menu,            EUTtype,        SystemSet,*Function_ShutOff} 

http://www.ouravr.com/bbs/bbs_content.jsp?bbs_sn=1054447&bbs_page_no=1&bbs_id=9999

文章评论0条评论)

登录后参与讨论
我要评论
0
5
关闭 站长推荐上一条 /2 下一条