精品文档
TimeMenu[0].ChildrenMenus = &Null; TimeMenu[0].ParentMenus = MainMenu;
TimeMenu[1].MenuCount = 4;
TimeMenu[1].DisplayString = \ TimeMenu[1].Subs = DateSet; TimeMenu[1].ChildrenMenus = &Null; TimeMenu[1].ParentMenus = MainMenu;
TimeMenu[2].MenuCount = 4;
TimeMenu[2].DisplayString = \ TimeMenu[2].Subs = AlertSet; TimeMenu[2].ChildrenMenus = &Null; TimeMenu[2].ParentMenus = MainMenu;
TimeMenu[3].MenuCount = 4;
TimeMenu[3].DisplayString = \ TimeMenu[3].Subs = NullSubs;
TimeMenu[3].ChildrenMenus = MainMenu; TimeMenu[3].ParentMenus = MainMenu; }
/************************************************************** * 函数说明:根目录初始化 *
精品文档
精品文档
**************************************************************/ void MainMenuInit(void) {
MainMenu[0].MenuCount = 3;
MainMenu[0].DisplayString = \ MainMenu[0].Subs = NullSubs;
MainMenu[0].ChildrenMenus = TimeMenu; MainMenu[0].ParentMenus = &Null; MainMenu[1].MenuCount = 3;
MainMenu[1].DisplayString = \ MainMenu[1].Subs = NullSubs;
MainMenu[1].ChildrenMenus = VoiceMenu; MainMenu[1].ParentMenus = &Null; /*
MainMenu[2].MenuCount = 3;
MainMenu[2].DisplayString = \ MainMenu[2].Subs = NullSubs;
MainMenu[2].ChildrenMenus = RobotMenu; MainMenu[2].ParentMenus = &Null; */
MainMenu[2].MenuCount = 3;
MainMenu[2].DisplayString = \ MainMenu[2].Subs = NullSubs;
MainMenu[2].ChildrenMenus = FlashMenu;
精品文档
精品文档
MainMenu[2].ParentMenus = &Null; }
struct MenuItem (*MenuPoint) = MainMenu; short DisplayStart = 0; short UserChoose = 0; short DisplayPoint = 0; short MaxItems; /***************************** * Struct MenuItem: * * short MenuCount; * * char *DisplayString; * * void (*Subs)(); * * MenuItem *ChildrenMenus;* * MenuItem *ParentMenus; * *****************************/ /*********************** * 函 数 声 明 区 * ***********************/ extern void ClearWatchDog(); void MenuInitialation(void); void SystemInitialation(void); void ShowMenu(void); short GetKeyNum(void);
精品文档
精品文档
/************************************************************** * 函数说明:系统初始化函数 * **************************************************************/ void SystemInitialation(void) {
Init_sys();
Enable_LCD(); //初始化字库 函数定义在Splc501sys.asm MenuInitialation(); //初始化菜单 GRAPH //图形初始化 }
/************************************************************** * 函数说明:目录初始化函数 * **************************************************************/ void MenuInitialation(void) {
MainMenuInit(); TimeMenuInit(); VoiceMenuInit(); RobotMenuInit(); FlashMenuInit(); }
/************************************************************** * 函数说明:目录显示函数 * **************************************************************/
精品文档
精品文档
void ShowMenu(void) {
short n = 0;
MaxItems = MenuPoint[0].MenuCount; DisplayPoint = DisplayStart; if (MaxItems >= 4) {
for (n = 0;n<4;n++) {
LOCATE(n+1,1);
PRINT(MenuPoint[DisplayPoint].DisplayString);
if ((DisplayPoint) == UserChoose) {
BOX(1,n*16+1,126,(n+1)*16-2,1,1); }
DisplayPoint +=1;
if ((DisplayPoint) == (MaxItems)) {
DisplayPoint = 0; } }
精品文档