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" page).
Note the values in these windows are only valid when the debug session is paused. 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.