cancel
Showing results for 
Search instead for 
Did you mean: 

STM8S103 problem with ++

adriano2
Associate II
Posted on October 08, 2009 at 13:09

STM8S103 problem with ++

3 REPLIES 3
adriano2
Associate II
Posted on May 17, 2011 at 15:05

Dear All

I have a too strange behaviour with the following code:

while (HS_Values_X[uC++] < Conversion_Values[0]);

HallAngle[0] = HS_ANGLE_X[uC-1];

In fact, by following the code step by step with the debugger uC variable increase three by three any step (and not by one).

I changed the firwmare:

while (HS_Values_X[uC] < Conversion_Values[0])

{

uC++;

}

HallAngle[0] = HS_ANGLE_X[uC-1];

but I obtain the same strange behaviour. Why?

Some one could help me!?! I have set the compiler in order to minimize the code size.

Thanks

mozra27
Associate II
Posted on May 17, 2011 at 15:05

Hi Genius,

The uC variable should be declaration as volatile... thanks to check this point.

Regards

mozra

adriano2
Associate II
Posted on May 17, 2011 at 15:05

I solved and the problem is the STVD IDE, in fact I had the HS_Values_X[uC++] term in the Watch. By removing it from the watch all work.

For some strange reason the Watch modify the variable :-Y

thanks