Datasheet
dsPICDEM™ 80-Pin Starter Development Board User’s Guide
DS51584B-page 22 © 2006 Microchip Technology Inc.
2.7 DEBUGGING THE CODE
The MPLAB ICD 2 In-Circuit Debugger is used to run, halt and step the code. A
breakpoint can be set so that the program halts once the code has executed the
instruction at the breakpoint. The contents of the RAM and registers can be viewed
whenever the processor has been halted.
The MPLAB ICD 2 In-Circuit Debugger uses the following function keys to access the
main debugging functions:
In addition, there are more functions available by right clicking on a line of source code.
The most important of these are “Set Breakpoint” and “Run to Cursor”.
2.7.1 Display the Code
1. From the View menu, select the Program Memory menu.
2. On the Program Memory window, select the Symbolic tab, as shown in
Figure 2-14.
FIGURE 2-14: PROGRAM MEMORY WINDOW
3. Press <F5> to halt the processor and press <F6> to reset. The program memory
now shows a green arrow pointing to the line of code at address 00000, the reset
location.
The instruction at this location is goto _reset. This code is added by the linker
to make the program branch to the start of the code in the Eg1_BlinkLed.s file.
The code uses the _reset label at the start of the executable code and declares
the label as global to have visibility outside the source file. See Example 2-1.
EXAMPLE 2-1: CODE START-UP
The linker also provides values for the __SP_init and __SPLIM_init
constants to initialize the Stack Pointer (W15) since the linker determines what
RAM is available for the stack.
<F5> Halt
<F6> Reset
<F7> Single Step
<F9> Run
.global __reset
..text
__reset: mov #__SP_init, W15 Pointer
mov #__SPLIM_init, W0
mov W0, SPLIM