Datasheet
PICkitâ„¢ 3 Debug Express Lessons
© 2009 Microchip Technology Inc. DS41370C-page 43
3.6.5 Watching Variables and Special Function Registers
All the values in the file registers can be seen by opening View > File Registers, and
the values in the Special Function Registers can be seen by opening View > Special
Function Registers. However, keeping these windows open is not recommended. This
is because the entire file memory and all SFRs must be read from the target device
whenever it is Run, Halted, and on each Step. Reading all of this data over the ICD bus
can take a significant amount of time. The actual time it takes depends on how much
memory the target PIC18FXXXX has, and how fast the target oscillator is. The slower
the target oscillator, the longer it will take as the oscillator speed directly affects the ICD
bus speed.
If you have opened either of these windows, please close them now.
The best way to watch variables and SFRs is to use a Watch window. This way, only
the variables and registers that are of interest are updated. To open a Watch window,
select View > Watch
.
FIGURE 3-35:
WATCH WINDOW
SFRs may be added to the Watch window by selecting them in the dropdown box on
the upper left, and clicking the Add SFR button. Go ahead and add PORTB, which is
used to read the switch state, and LATD, which our program uses to set the LEDs.
User variables are added using the dropdown on the upper right, and clicking the Add
Symbol button.
Add the
LED_Display, SwitchPressed, and Direction variables now.
Note: The number of active breakpoints can affect using the Step Into and Step
Over functions. When these functions are used, a breakpoint is set at the
next statement to step to. If all breakpoints are currently used and none are
available, the MPLAB IDE is not able to set a breakpoint on the next C
statement. Instead, it must step through each assembly instruction until the
next statement is reached. If using Step Over, it may take some time to step
over all the assembly functions in the compiled function. Free up a
breakpoint to avoid this issue.