Difference Between Watches and Variables Windows
Both the Watches and Variables windows are used to view and modify microcontroller (MCU) data memory during a debug session. The difference between the two windows is the type of variable that can be viewed in each.
Watches Window | Variables Window |
---|---|
Global variables | Local variables |
Peripheral configuration registers | Function parameters |
Static local variables |
The Watches window can only view variables and MCU registers that have a permanent memory address. These include global variables (variables defined outside of any function), peripheral configuration registers (also known as special function registers or SFRs), and local variables defined as static.
The Variables window is used to view local variables. These variables are defined inside functions and are created (allocated on the stack) when a function is called and destroyed (de-allocated from the stack) when the function exits. Local variables do not have a permanent address.
If you want to see all variables in one window, you can add the Watches window content to the Variables window (see the "Watches In Local Variables View" section of the Using the Watches Window to Access Global Variables and Registers (SFRs) page).