Dear all,
I never faced this problem before so I'm a little bit lost.
MCU: S9S08QD4
CW=6V1
I'm debbuging a new code just adquiring some signals from the ADCH0 and ADCH1, called Vbat and Vshunt, as follows:
void adquisition(void){
unsigned int contcicles=0, limit=0,Vbat=0;
unsigned int Vshunt=0;
....
Vbat=getValorAD(0);
Vshunt=getValorAD(1);
....
}
When debbuging the code and reach this function all the local variable are listed expect for Vshunt, if I declare it as global variable it works perfectly, (data adquired is correct so Hw is working fine). What is going on? Anybody faced it before?
I'm using the startup code generated for the wizard (start08.c)
BR
MarC
Solved! Go to Solution.
Hello
This is due to optimization, Local variables are kept into registers and if they are not used anymore later on in the function, their value is not copied over to the stack.
In order to get the value of the local variable copied to its stack location you can
Note that all these solutions will make it easier to debug your code, but will generate additional code, which will increase execution time..So it could bea good idea to implement that only for the debug configuration of your target.
CrasyCat
Hello
This is due to optimization, Local variables are kept into registers and if they are not used anymore later on in the function, their value is not copied over to the stack.
In order to get the value of the local variable copied to its stack location you can
Note that all these solutions will make it easier to debug your code, but will generate additional code, which will increase execution time..So it could bea good idea to implement that only for the debug configuration of your target.
CrasyCat
Thanks Catherine for you statment.
I tested it with static unsigned int, and works it helps a lot during the debug process.
BR