When debugging an MPLAB® X project you may find it useful to view the variables and PIC® Special Function Registers (SFRs). Global Variables and SFRs have permanent and fixed memory devices. All programs can access these data elements at any time. This page shows how to access Global variables and SFRs. At the end of this page is a link to a tutorial demonstrating how to access Watches.
What is the Watches Window
The Watches Window is the MPLAB X utility which allows the user to observe and modify Global Variables and SFRs This window is the part of the standard MPLAB X debug tools and can be used anytime during an active debug session. The variables window operates with all MPLAB X support debug tools (software simulator, ICD 3, REAL ICE™, and PICKit™ 3) Many 3rd party debug tools and simulators also allow the Watches Window to operate
How to Open the Watches Window
To open the Watches window:
- Make sure you are in a debug session
- Select Windows->-Debugging->Watches or ( atl + shft + 2)
The Watches window will open up in the output window section (usually the lower right-hand side)
Any value left in the Watches Window from a previous debug session will remain in the Watches window when it is reopened. This avoids the necessity of reloading Watches. To erase the watches from a previous session. Right Click in the Watches Window, then select Delete All
Adding Items to the Watches Window
To add an element to the list of items being watched first "Right Click" in the open Watches Window then select "Add New Watch" from the menu.
A pop-up menu will display allow you to select either a Global Variable or a Special Function Register to add to the Watch. Select the either SFR or Global Symbol. Once Selected the box will fill with a list of all the Global Symbols or SFRs. Select the individual item you wish to add to the Watches Window then select "OK".
Repeat these steps until you have added all the desired Watches
Modifying the Display Properties
"Right Clicking" on the menu bar of the Watches Window will cause the "Display Visible Options" window to pop-up. This will allow you to add and remove display columns. You can change the width of each column or sot the table by the elements in each
By "left clicking" on either the Type or Name heading you will be able to sort the entries in the Watches window
Saving Watches to a file
User's have the option to save the current list of item in the Watches Window to a file. User can also reload the list of watch from a saved file. Two icons on the left hand side of the Watches Window control these functions.