This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Compiler/TMS320F28335: while instruction cause dead loop

Part Number: TMS320F28335


Tool/software: TI C/C++ Compiler

I am using CCS 7.0.0 and  Ti V6.2.9 compiler. in the following code, statement "while (ReceivedChar == 0) ;" causes the program always  stays here and cannot continue even when ReceivedChar got a non-zero value from serial port interrupt, when I pause the program, in expression watch window, I can see that variable "Receivedchar" has a non-zero value which matches the  value of the character received from serial port, but the program cannot skip out this while loop. if I changed this while statement to "if (Receivedchar !=0)", program works fine. I do not know why, thanks for help

for(;;)
{

// Wait for inc character


while (ReceivedChar == 0);


// Get character
//ReceivedChar = SciaRegs.SCIRXBUF.all;
{
// Echo character back
msg = " You sent: \0";
scia_msg(msg);
scia_xmit(ReceivedChar);
ReceivedChar = 0;
msg = "\r\nEnter a character: \0";
scia_msg(msg);
}
LoopCount++;
}