14.16.1 Program Memory Window

The Program Memory window displays locations in the range of program memory for the currently selected processor. If external program memory is supported by the selected device and enabled, it will also appear in the Program Memory window.

For the MPLAB X Simulator, when a program memory value changes or the processor is halted, the data in the Program Memory window is updated.

For any Microchip hardware debug tool (e.g., PICkit 5 in-circuit debugger), when a program memory value changes or the processor is halted, the data in the Program Memory window is NOT updated; you must do a Read of device memory.

When using a hardware tool for debug, some registers may show an R for each nibble of data to represent a reserved resource.

If your project device uses RAM banking, see also:

14.1.2 Banked Data Memory and Values Displayed in Windows

Figure 14-46. Program Memory Window with Content

Program Memory Window Displays

You may specify how memory is displayed in the window by selecting from the Format drop-down box on the bottom of the window.

When using a hardware tool for debug, some registers may show an R for each nibble of data to represent a reserved resource.

Code Format

Code format displays disassembled hex code with symbols. The window will have the following columns:

  • Debug Info – Information useful for debugging
. A pointer shows the current location of the program counter.
  • Line – Reference line number.
  • Address – Opcode hexadecimal address.
  • Opcode – Hexadecimal opcode, shown in 2- or 3-byte blocks
For most PIC MCUs, these blocks represent words. 
For PIC18CXXX devices, the blocks represent 2 bytes. 
For dsPIC DSC devices, the blocks represent 3 bytes.
  • Label (Symbolic Only) – Opcode label in symbolic format.
  • Disassembly – A disassembled version of the opcode mnemonic.

Hex Format

This format displays program memory information as hex code. The window will have the following columns:

  • Address – Hexadecimal address of the opcode in the next column.
  • Opcode Blocks – Hexadecimal opcode, shown in 2- or 3-byte blocks 
For most PIC MCUs these blocks represent words. For PIC18CXXX devices, the blocks represent 2 bytes. For dsPIC DSC devices, the blocks represent 3 bytes.
The opcode block that is highlighted represents the current location of the program counter.
  • ASCII – ASCII representation of the corresponding line of opcode.

PSV Mixed (dsPIC DSC/PIC24 devices only)

This format displays program memory as opcode and the PSV area (CORCON register, PSV bit set). The window will have the following columns:

  • Debug Info – Information useful for debugging. A pointer shows the current location of the program counter.
  • Line – Reference line number.
  • Address – Opcode hexadecimal address.
  • PSV Address – Data space hexadecimal address of the opcode.
  • Data – Opcode formatted as data.
  • Opcode – Hexadecimal opcode, shown in 3-byte blocks.
  • Label – Opcode label in symbolic format.
  • Disassembly – A disassembled version of the opcode mnemonic.

For more information, see the dsPIC30F Family Reference Manual (DS-70046) or the dsPIC33/PIC24 Family Reference Manual (DS-70000618, etc.)

PSV Data (dsPIC DSC/PIC24 devices only)

This format displays program memory as file registers, for when program space is visible in data space (CORCON register, PSV bit set). The window will have the following columns:

  • Address – Program space hexadecimal address of the data.
  • PSV Address – Data space hexadecimal address of the data.
  • Data Blocks – Hexadecimal data, shown in 3-byte blocks
. The highlighted data block represents the current location of the program counter.
  • ASCII – ASCII representation of the corresponding line of data.

For more information, see the dsPIC30F Family Reference Manual (DS-70046) or the dsPIC33/PIC24 Family Reference Manual (DS-70000618, etc.)

Program Memory Window Icons

Icons are located on the left side of the window.

Table 14-45. Program Memory Window Icons
Icon Icon Text Function
Refresh by Read Device Memory Same function as the Debug toolbar “Read Device Memory” icon - uploads device memory to the MPLAB X IDE.
Find Specify a string to find in the window. Select to match whole word or case.
Find Next Find next instance of string from Find.
Find Previous Find previous instance of string from Find.
Go To Go to specified line number or address.

Program Memory Window Menus

Right click in the memory window data area set to CODE OR PSV MIXED FORMAT to pop up this menu. Not all items may be visible for all devices.

Table 14-46. Program Memory Window Menu - Code/PSV Mixed
Item Description
Run to Cursor Run the program to the current cursor location.
Step Instruction Perform a step instruction.
Set PC at Cursor Set the Program Counter (PC) to the cursor location.
Focus Cursor at PC Move the cursor to the current PC address and centers this address in the window.
Toggle Breakpoint Toggle (on/off) existing breakpoint.
Symbolic Mode Display disassembled hex code with symbols.
Verbose Labels PSV Mixed Format Only

Show internal compiler labels.

Fill Memory Fill memory from Start Address to End Address with the value in Data.

Specify other options in the Fill Memory dialog.

Go To Go to the address/function specified using the Go To dialog.
Go To Source Line Go to the corresponding line in source code in the editor.
Find Find text specified using the Find dialog.
Output To File Write the displayed window contents to a text file using the Output to File dialog.
Print Print the contents of this window using the Print dialog.
Note: If you have a large memory device, the number of pages printed can become very large. A suggestion is to print the window contents to a file (Print dialog, General tab, Print to File check box) and then select which pages from the file you need to print.
Adjust Table Columns Adjust the columns automatically.

Right click in the memory window data area set to HEX OR PSV DATA FORMAT to pop up this menu. Not all items may be visible for all devices.

Table 14-47. Program Memory Window Menu - Hex/PSV Data
Item Description*
Hex Display Width Hex Format Only

Set the hexadecimal display width (Options depend on the device selected).

Fill Memory Fill memory from Start Address to End Address with the value in Data.

Specify other options in the Fill Memory dialog.

Go To Go to the address/function specified using the Go To dialog.
Find Find text specified using the Find dialog.
Output To File Write the displayed window contents to a text file using the Output to File dialog.
Import Table Import tabular data from a file into a Memory window using the Import Table dialog.
Export Table Export tabular data from a Memory window into a file using the Export Table dialog.
Print Print the contents of this window using the Print dialog.
Note: If you have a large memory device, the number of pages printed can become very large. A suggestion is to print the window contents to a file (Print dialog, General tab, Print to File check box) and then select which pages from the file you need to print.
Adjust Table Columns Adjust the columns automatically.