problem about checking the USART receive data

tshuck

Joined Oct 18, 2012
3,534
I tried this method, but in order to do that, I have to comment out the USART_Receive function and define a value for 'info'. If I don't do that, the compiler will wait at code
info = USART_Receive();
function in order to assign data to 'info'.
So set a breakpoint after that.... you just need to see what is being evaluated in your if statement....
 

spinnaker

Joined Oct 29, 2009
7,830
I tried this method, but in order to do that, I have to comment out the USART_Receive function and define a value for 'info'. If I don't do that, the compiler will wait at code
info = USART_Receive();
function in order to assign data to 'info'.
You are accomplishing nothing when you do that. You really need to learn to use your debugger. Before going any further read up on how to use the debugger.

Once the debugger stops you can continue again. You should also be able to set a breakpoint then a variable reaches a certain value or the breakpoint is passed a set amount of times.
 

spinnaker

Joined Oct 29, 2009
7,830
Don't know if your mcu has an rs232 out for debug but you can also debug the old fashioned way by printing values to the terminal.
 

Thread Starter

kj4g09

Joined Dec 4, 2011
29
I added a watch point in the if statement, but I can not see the value of variable 'info', which shows 'optimized away'.
 
Top