Watch Symbol Values Change

Watch the values of symbols that you have selected change in the Watches window. Knowing whether these values are set as expected during program execution will help you to debug your code.

The following symbols may be added to a Watches window:

In general, you must Pause from debugging to be able to see updated values. However, some tools allow runtime updates (you can see the values change as your program is running). Check your tool documentation to see if it supports this feature.

For all devices except PIC32 MCUs, symbols used in a runtime watch must be sized to match the device memory. That is, you need 8-bit symbols when using an 8-bit device.

For C-language enumerated types, you may enter either the enum label (text) or integer value in the window. For labels, be aware that they are case sensitive.

Figure 1. Watches Window – Program Pause

To view the Watches window do one of the following:

To create a new watch directly:

You can add a symbol directly to the Watches window by doing one of the following:

To create a new watch using the New Watch dialog:

You can add a symbol or SFR to the Watches window by doing one of the following:

To create a new runtime watch:

Before you add a runtime watch to the Watches window, you need to set up the clock:

  1. 1.Right click on the project name and select “Properties.”
  2. 2.Click on the debug tool name (e.g., PICkit 4), and select the “Clock” option category.
  3. 3.Set the runtime instruction speed.

To add a global symbol or SFR as a runtime watch, follow the instructions under To create a new watch using the New Watch dialog:, except select “New Runtime Watch” instead of “New Watch.”

For all devices except PIC32 MCUs, symbols used in a runtime watch must be sized to match the device memory. That is, you need 8-bit symbols when using an 8-bit device.

To view symbol changes:

  1. 1.Debug and then Pause your program.
  2. 2.Click the Watches tab to make the window active.
  3. 3.For watch symbols, continue the debug session and Pause to see changing values. For runtime watch symbols, continue Debug and watch the values change as the program executes.

You must be in a debug session to see the values of symbols – global symbols, SFRs, arrays, register bitfields, etc.

Note: You cannot view the value of macros in this way. Use the Macro Expansion Window by right clicking on the macro in the editor during debug.

To change the radix of a watch symbol:

Right click in the line of the symbol and select “Display Value As.”

To perform other tasks:

For more on watches, see Watches Window.