Watch the values of global symbols or SFRs change in the Watches window. Determining if these values are as expected during program execution will help you to debug your code.
Click the “Finish Debugger Session” icon .
Currently pot_value
is a local symbol. To make it a global symbol,
declare it before main()
.
#include "mcc_generated_files/mcc.h" uint16_t pot_value; /* Main application */ void main(void)
Then remove uint16_t
from the line that contains the first usage of
this symbol.
while (1) { // Add your application code pot_value = ADCC_GetSingleConversion(POT);
Place a breakpoint at this line and again click the “Debug Project” icon
. The program should halt on this line.
To create a new watch:
pot_value
, and then
click OK. The Watches window will now appear on the desktop with the
symbol.Click the “Debug Project” icon . The
code will execute and stop at the breakpoint.
pot_value
information
will be shown in the Watches window.
Turn the pot on the board so the value will change. Click the “Continue”
icon . The code will execute and stop at the breakpoint again. View the Watches window
to see that the value has changed.
For more on this window, see Watches Window.