Using Embedded Memory Windows to Access Program Memory, Config Bits, EEPROM, etc.

Last modified by Microchip on 2024/06/24 06:30

Most PIC® microcontrollers have several different memory types and memory regions that need to be displayed while debugging. All of these memory views are accessed from a common location under the Window menu.

In MPLAB® X, all embedded memory types are accessed from the main menu by selecting Window > PIC Memory Views > View, where the view is one of the following:

Program Memory

Display from the main menu: Window > PIC Memory Views > Program Memory

This view shows you the contents of program memory (Flash) in one of several possible formats.

The format of the display may be changed by choosing a different selection from the Format combo box at the bottom. Choices include Hex, Symbol, and others specific to the device architecture such as PSV Data for 16-bit PIC® microcontrollers. Examples of both symbolic and hex displays are shown in the accompanying images.

program memory

Under some circumstances, a program memory location's contents may be changed by double-clicking on the value, typing in a new value, and hitting the Enter key.

The display may be quickly changed to another type by choosing a new selection from the Memory combo box at the bottom left.

Back to top

File Registers

Display from the main menu: Window > PIC Memory Views > File Registers

This view shows you the contents of data memory (RAM) in one of several possible formats.

The format of the display may be changed by choosing a different selection from the Format combo box at the bottom. Choices include Hex, Symbol, and others specific to the device architecture such as XY Data for 16-bit PIC® microcontrollers. Examples of both symbolic and hex displays are shown in the accompanying images.

file registers

While in an active debug session with your program halted, you can change a file register's contents by double-clicking on its current value (see instructions below). Just type in a new value and hit the Enter key. The new value will take effect as soon as you start running the program again.

The display may be quickly changed to another type by choosing a new selection from the Memory combo box at the bottom left.

Change the Value in a File Register

While debugging your application, you can easily change the value in a File Register to test how your program will react to different values. This will work in either an embedded memory window or in a watches window.

Double click on top of a memory location's value or on top of a watches window value. The box should become editable with a blinking cursor or with the text highlighted.
ChangeRegisterPre.png

Enter a new value. When you leave the box, the text should now be red to indicate that it has changed.
ChangeRegisterPost.png

Back to top


Special Function Registers (SFRs)

Display from the main menu: Window > PIC Memory Views > SFRs

special function registers (SFRs)

This view shows you the contents of the SFR, which are part of data memory space but have specific uses with respect to controlling and interacting with the microcontroller's hardware and on-chip peripherals.

While in an active debug session with your program halted, you can change a special function register's contents by double-clicking on its current value. Just type in a new value and hit the Enter key. The new value will take effect as soon as you start running the program again.

The display may be quickly changed to another type by choosing a new selection from the Memory combo box at the bottom left.

Back to top

Configuration Bits

Display from the main menu: Window > PIC Memory Views > Configuration Bits

This view shows the current settings of the device's Configuration Bits, which are special EEPROM registers mapped into program space beyond the range of the program counter. These settings are typically picked up from your code's configuration directives. However, this window may be used to setup the configuration bits and generate a file with the code that explicitly initializes each and every configuration bit.

Configuration Bits

The nice thing about setting configuration bits from this window is that you can configure everything via point-and-click. Simply click on a line in the Setting column and it will become a combo box listing all of the possible options for that configuration setting. Using this in conjunction with the Generate Source Code To Output button to specify your configuration settings has several benefits:

  1. The more intuitive configuration bits window helps to eliminate errors due to the somewhat cryptic configuration directives in code.
  2. The code generator explicitly initializes each configuration setting, so there is no doubt as to what the defaults might be.
  3. It eliminates the need to look up the symbol names and syntax required for writing the configuration code yourself.

See the MPLAB X IDE® Viewing and Setting Configuration Bits page for additional details.

Configuration Bit Settings

Back to top

EEPROM Data Memory

Display from the main menu: Window > PIC Memory Views > EEPROM Data Memory

This view displays the contents of EEPROM data memory on devices that support this feature. If the menu entry is inactive, then the target device of your project doesn't have EEPROM data memory.

EEPROM data

Back to top

Other Memory

Display from the main menu: Window > PIC Memory Views > Other Memory

File Registers

On most devices, this view will simply open another embedded memory window that may be configured any way you like. It can be useful for opening two views of the same type so that you can look at two different locations in the same memory space simultaneously.

Back to top