Skip to main content
Visitor II
October 8, 2009
Question

STM8S103 problem with ++

  • October 8, 2009
  • 3 replies
  • 816 views
Posted on October 08, 2009 at 13:09

STM8S103 problem with ++

    This topic has been closed for replies.

    3 replies

    adriano2Author
    Visitor II
    May 17, 2011
    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

    Visitor II
    May 17, 2011
    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

    adriano2Author
    Visitor II
    May 17, 2011
    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