This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Local Watch Window variables have wrong values...

While using the uV2 dscope debugger (in bootstrap loader mode) on my C167 board, the variables in my local watch window seemed to be working just fine, for a while, and then one of the local var's didn't seem to work anymore. For example, in the below code snippet, the local var 'i' always shows that it has the value of '1' in the watch window, no matter what the value of 'x' is displayed as, as I step past the code that assigns the value of 'x' to 'i'; and as the code is stepped through the ++i statement. Anyone know why this might be, and how I can fix it?

// U1 is a 16-bit latch clocked by CS4-
// U1 inputs are connected to the uC data bus
#define U1 HVAR(unsigned int 0x400000)
void foo(unsigned int x){
    unsigned int i;
    i = x;
    while(i){
        U1=i++;
    }
}

The while(i) loop does execute the expected number of times (based on the value of 'x' passed to the function).

I'm stumped...!

0