Watches Window

 Summary

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 that allows you to observe and modify Global Variables and SFRs. This window is 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 4, REAL ICE™, and PICKit™ 4). Many third-party debug tools and simulators also allow the Watches window to operate.

In order to operate the Watches window, MPLAB X must be in operating in a debug session Main_Debug_Project.png

How to Open the Watches Window

  1. Make sure you are in a debug session.
  2. Select Windows > Debugging > Watches (or ATL+SHIFT+2).
OpeningWatches.png

The Watches window will open up in the Output window section. (Usually the lower right-hand side.)

OpenedWatches.png

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. To erase the Watches from a previous session, right-click in the Watches window, then select Delete All.

DeleteAllWatches.png

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 New Watch from the drop-down menu.

NewWatch.png

A pop-up menu will display and allow you to select either a Global Variable or a SFR 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, then select OK.

NewGlobalWatch1.png NewSFRWatch1.png


Repeat these steps until you have added all the desired Watches.

Watchesloaded.png

Modifying the Display Properties

Right-click on the menu bar of the Watches window to bring up the Display Visible Options window. This will allow you to add and remove display columns. You can change the width of each column or sort the table by the elements in each.

rightclickdisplay.png DisplayVisible.png


Left-click on either the Type or Name heading to sort the entries.

WatchesSort.png

Saving Watches to a file

You have the option to save the current list of items in the Watches window to a file. You can also reload the list of watches from a saved file. Two icons on the left-hand side of the Watches window control these functions.

WatchesFile.png
© 2024 Microchip Technology, Inc.
Notice: ARM and Cortex are the registered trademarks of ARM Limited in the EU and other countries.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.