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

Code not executing correctly

Hello. I have been working in uVision3 up until a few days ago when my company upgraded to uVision4. I am working on a project in which I read in a string over the UART. The strings start with a couple 0xFF characters and terminate with a couple 0xFE characters (customer-driven). My process is to read in the characters until I receive the termination then call a function to parse the string and execute the instruction. See code below.

char input_buffer[200];

void UART0_ISR(void) interrupt 4{
    static int i = 0;
    char temp;

    if (RI0){
        RI0 = 0;
        temp = SBUF0;
        if (temp == 0xFF){                 // reading a new instruction
            reset_input_buffer();          // fill buffer with 0's
            i = 0;
        }
        input_buffer[i] = temp;
        if (temp == 0xFE) Parse_Msg();     // parse string and execute
        else i++;
    }
}

The problem I'm having is at if (temp == 0xFE). Stepping through, I find that even if the expression resolves to true, the code executes the else i++ instead.

The code worked fine before the upgrade. Is there something different between the compiler versions that could be causing this? There are other similar instances of code not executing, but this is the first that needs debugging.

Thanks.