AnsweredAssumed Answered

why this  pointer err  in codewarrior  in S12XS128MAA

Question asked by kevin shang on May 4, 2012
#ifndef __MENU_H__#define __MENU_H__#include "PE_Types.h"#include "PE_Error.h"//定义菜单项数据结构typedef struct menu1{    byte   MenuType;     //本菜单种类    byte     MenuName[15];   //本菜单名称    byte     MenuFunctionInfo[30]; //本菜单功能说明    byte   *pMenuLeftInfo;   //本菜单Left键功能说明    byte   *pMenuRightInfo;  //本菜单Right键功能说明    const struct menu1  *pFarther;    //定义父菜单指针    const struct menu1  *pSon;     //定义子菜单指针    const struct menu1  *pPre;     //定义上一个兄弟菜单    const struct menu1  *pNext;     //定义下一个兄弟菜单    void   (*far pOn_OK_Button)(void);   //OK键处理函数指针    void   (*far pOn_Left_Button)(void);  //Left键处理函数指针    void   (*far pOn_Right_Button)(void);  //Right键处理函数指针}Menu_t;void Menu_On_OK(void);void Menu_Go_Pre(void);void Menu_Go_Next(void);void Menu_Config_On_OK(void);void Menu_Run_On_OK(void);#endif

 

#ifndef __SETTINGSCREEN_H__#define __SETTINGSCREEN_H__#include "PE_Types.h"#include "Menu.h"#include "MenuRes.h"#include "stddef.h"void SettingScreen(byte keyBuf); //画面结构显示函数#endif

 

#include "Menu.h"#include "MenuRes.h"#include "SettingScreen.h"#include "LQ12864.h"#include "stddef.h"#include "PE_Types.h"#include "Events.h"  /*当前菜单指针*/Menu_t const   *pCurrentMenu, *pCurrntmenuPre,      *pCurrentMenuNext, *pCurrentMenuNextNext; //当前菜单组指针Menu_t const (*pCurrentMenuList)[]; /*---current menu pointer init to first level menu---*/pCurrentMenu = MenuList_Top;                                                                //err here not decl /*---current menu arry pointer init to first level menu arry---*/pCurrentMenuList = MenuList_Top;void SettingScreen(byte KeyBuf){ byte i, Menu_item_num, Menu_item_disp_num; byte Jiantou = 66; byte *pJiantou = &Jiantou;    //get the number of current menu arry Menu_item_num = sizeof(*pCurrentMenuList) / sizeof(Menu_t);     //get the number how many items to display on screen    //if less than 4 , display all, otherwise display 4 if(Menu_item_num < 4) Menu_item_disp_num = Menu_item_num; else Menu_item_disp_num = 4;     //display crrent menu's left key function info LCD_CLS_XY(2, 0, 128, 0); LCD_P6x8Str(2, 0, pCurrenMenu->pMenuLeftInfo);     //display crrent menu's right key function info LCD_CLS_XY(2, 1, 128, 1) LCD_P6x8Str(2, 1, pCurrentMenu->pMenuRightInfo);     //display crrent menu's function info LCD_CLS_XY(2, 6, 128, 7); LCD_P6x8Str(2, 6, pCurrentMenu->MenuFunctionInfo);     //display fouce menu sign arry LCD_P6x8Str(12, 3, pJiantou);     //to display menus in crrent menulist if(Menu_item_disp_num > 1)   // if menu items more than one  {   //first menu item  pCurrentMenuPre = pCurrentMenu->pPre;  LCD_CLS_XY(20, 2, 100, 2);  LCD_P6x8Str(20, 2, pCurrennMenuPre->MenuName); } if(Menu_item_disp_num > 0)   //we always get menu to display {  LCD_CLS_XY(20, 3, 100, 3);  LCD_P6x8Str(20, 3, pCurrentMenu->MenuName); } if(Menu_item_disp_num > 2) {  pCurrentMenuNext = pCurrentMenu->pNext;  LCD_CLS_XY(20, 4, 100, 4);  LCD_P6x8Str(20, 4, pCurrentmenuNext->MenuName); } if(Menu_item_num > 3) {  pCurrentMenuNextNext = pCurrentMenuNext->pNext;  LCD_CLS_XY(20, 5, 100, 5)  LCD_P6x8Str(20, 5, pCurrentMenuNextNext->MenuName); }  switch(KeyBuf) {    case Button_OK:   if(pCurrentMenu->pOn_OK_Button != NULL &&     pCurrentMenu->pSon == NULL)   {    *pCurrentMenu->pOn_OK_Button();   }   else   {    if(pCurrentMenu->MenuName == "Done")    {     pCurrentMenu = pCurrentMenu->pFarther;    }    else    {      pCurrentMenu = pCurrentMenu->pSon;    }   }   break;  case Button_Left:   if(pCurrentMenu->pPre == NULL && pCurrentMenu->pNext == NULL    && pCurrentMenu->pOn_Left_Button != NULL)   {    *pCurrentMenu->pOn_Left_Button();   }   else   {    pCurrentMenu = pCurrentMenu->pPre;   }   break;  case Button_Right:   if(pCurrentMenu->pNext == NULL && pCurrentMenu->pPre == NULL    && pCurrentMenu-pOn_Right_Button != NULL)   {    *pCurrentMenu->pOn_Right_Button();   }   else   {    pCurrentMenu = pCurrentMenu->pNext;   }   break;  default:   break; }}

 

NAMESENDSEGMENTS  /* Here all RAM/ROM areas of the device are listed. Used in PLACEMENT below. */      RAM           = READ_WRITE    0x2000 TO   0x3FFF;      ROM_4000      = READ_ONLY     0x4000 TO   0x7FFF;      ROM_C000      = READ_ONLY     0xC000 TO   0xFEFF;      PAGE_F8       = READ_ONLY   0xF88000 TO 0xF8BFFF;      PAGE_F9       = READ_ONLY   0xF98000 TO 0xF9BFFF;      PAGE_FA       = READ_ONLY   0xFA8000 TO 0xFABFFF;      PAGE_FB       = READ_ONLY   0xFB8000 TO 0xFBBFFF;      PAGE_FC       = READ_ONLY   0xFC8000 TO 0xFCBFFF;      PAGE_FE       = READ_ONLY   0xFE8000 TO 0xFEBFFF;ENDPLACEMENT /* here all predefined and user segments are placed into the SEGMENTS defined above. */      _PRESTART,              /* Used in HIWARE format: jump to _Startup at the code start */      STARTUP,                /* startup data structures */      ROM_VAR,                /* constant variables */      STRINGS,                /* string literals */      NON_BANKED,             /* runtime routines which must not be banked */      COPY              INTO  ROM_C000, ROM_4000;      DEFAULT_ROM       INTO  PAGE_FE, PAGE_FC, PAGE_FB, PAGE_FA, PAGE_F9, PAGE_F8;      DEFAULT_RAM             /* all variables, the default RAM location */                        INTO  RAM;ENDINIT _EntryPoint                       /* The entry point of the application. This function is generated into the CPU module. */STACKSIZE 0x0080                       /* Size of the system stack. Value can be changed on the "Build options" tab */

 err message in attched picture

Outcomes