Datasheet

PICkit™ 3 Debug Express
DS41370C-page 66 © 2009 Microchip Technology Inc.
3.11.3 Exploring the Lesson 11 Source Code with PICkit 3 Debug
Express
At compile time, when the project is built, the Lesson 11 source code places three
strings in Flash program memory at address 0x100:
#pragma romdata mystrings = 0x100
rom char hello_str[] = "Hello!";
rom char mchp_str[] = "Microchip"; rom char fill_60[] =
"012345678901234567890123456789012345678901234567890123456789";
After building the project, the strings can be seen in program memory by opening the
Program Memory window in the MPLAB IDE using View > Program Memory
.
FIGURE 3-54: STRINGS IN PROGRAM MEMORY
The program code doesn’t start until address 0x280.
Build and program the Lesson 11 code and set a breakpoint on the first pointer
assignment statement as shown in Figure 3-55.
FIGURE 3-55: BREAKPOINT ON POINTER ASSIGNMENT
Run the program until it stops at the breakpoint. Step through the do while loop in
Figure 3-55 and observe the characters of the hello_str[] string are read into the
singlechar variable one at a time until the terminating ‘0’ value of the string is
reached.
The next statement demonstrates reading from an explicit program memory address
using a function:
singlechar = ProgMemRdAddress(0x107); // returns 'M' from "Microchip".