Passed Variables Getting scrambled Take Two

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Passed Variables Getting scrambled Take Two

2,899 次查看
mjcoury
Contributor I
I'm still looking for some ideas for this problem...

I enter a routine with passed variables....

Code:
int iTVI_LCDPing(char cBouy){    iTVI_AddQueue(TVI_CLEAR   , TVI_CLEAR_ALL, TVI_DELAY);  iTVI_AddQueue(TVI_FONT_SEL, TVI_FONT_MED , TVI_DELAY);    iTVI_AddQueue(TVI_COLUMN_START, 0x01         , TVI_DELAY);  iTVI_AddQueue(TVI_PAGE_START  , 0x01         , TVI_DELAY);  iTVI_TransmitStr("Watch the display and press '#' to ping the ");  switch(cMyStupidGlobal)  {    case SCI_A:      iTVI_TransmitStr("Pin");    break;    case SCI_B:      iTVI_TransmitStr("Boat");    break;  }  iTVI_TransmitStr(" Bouy");    return ERROR_NONE;}

after the 5 routines, CBouy is lost and gone forever and the switch command is performend on random data.... any ideas where to start looking?

 

标签 (1)
0 项奖励
回复
6 回复数

1,649 次查看
mjcoury
Contributor I
Update

I changed the code like this:

Code:
int iTVI_LCDPing(char cBouy){    char cMyTemp = (cBouy & 0xFF);    iTVI_AddQueue(TVI_CLEAR   , TVI_CLEAR_ALL, TVI_DELAY);  iTVI_AddQueue(TVI_FONT_SEL, TVI_FONT_MED , TVI_DELAY);    iTVI_AddQueue(TVI_COLUMN_START, 0x01         , TVI_DELAY);  iTVI_AddQueue(TVI_PAGE_START  , 0x01         , TVI_DELAY);  iTVI_TransmitStr("Watch the display and press '#' to ping the ");  switch(cMyTemp)  {    case SCI_A:      iTVI_TransmitStr("Pin");    break;    case SCI_B:      iTVI_TransmitStr("Boat");    break;  }  iTVI_TransmitStr(" Bouy");    return ERROR_NONE;}
and the problem goes away... according to the Debugging enviroment cMyTemp is never "assigned" and the problem has vanished....
 

0 项奖励
回复

1,649 次查看
alejmrm
Contributor II
Per you first implementation, the arg and the switch arg doesn't match... so I guess that the compiler optimaze your function argument, but the switch var must give you an error when compiling due it hasn't been declared... just my 2 cents.
0 项奖励
回复

1,649 次查看
mjcoury
Contributor I
Sorry - was changed for debugging

int iTVI_LCDPing(char cBouy)
{
 
  iTVI_AddQueue(TVI_CLEAR   , TVI_CLEAR_ALL, TVI_DELAY);
  iTVI_AddQueue(TVI_FONT_SEL, TVI_FONT_MED , TVI_DELAY);
 
  iTVI_AddQueue(TVI_COLUMN_START, 0x01         , TVI_DELAY);
  iTVI_AddQueue(TVI_PAGE_START  , 0x01         , TVI_DELAY);
  iTVI_TransmitStr("Watch the display and press '#' to ping the ");

  switch(cBouy)
  {
    case SCI_A:
      iTVI_TransmitStr("Pin");
    break;
    case SCI_B:
      iTVI_TransmitStr("Boat");
    break;
  }
  iTVI_TransmitStr(" Bouy");
 
  return ERROR_NONE;

}

0 项奖励
回复

1,649 次查看
CrasyCat
Specialist III
Hello
 
Do you have a prototype for the function iTVI_LCDPing before it gets called?
 
Otherwise, you may want to get one of our support engineer looking into that. I would recommend you submit  a service request for that.
Click here to submit a service request.
 
Make sure to attach  a project reproducing the issue and installed product information to the SR.
To make sure you provide all necessary project information, you can use the Pack and Go wizard.
  - Start the IDE
  - Open the Project
  - Select Help -> "Pack and Go"
  - Follow the instruction on the screen. That will generate a zip file containing all necessary
    information (including the installed product information).
 
CrasyCat
0 项奖励
回复

1,649 次查看
mjcoury
Contributor I
if you mean by prototype....


i have in

tvi_lcd.h

int iTVI_LCDPing(char cBouy);


like that?
0 项奖励
回复

1,649 次查看
CrasyCat
Specialist III
Hello
 
Yep. That is a prototype.
 
CrasyCat
0 项奖励
回复