2 Overview of 8-bit PIC Microcontroller Memory Organization
In 8-bit PIC microcontrollers, the device memory is broadly categorized into Program Flash Memory (PFM), Data RAM and Data Flash Memory (DFM). The PFM includes Program Memory and User ID space, and Data EEPROM space is referred to as DFM.
Memory Region | Memory Section | Memory Access | Description | Usage |
---|---|---|---|---|
Program Flash Memory | Program Memory | Read and write operations through ICSP interface and NVM functions | Partitioned into:
|
Stores the user's application code. |
User ID | Designated area in Program Flash memory | Stores application-specific product ID, Checksum or Code identification number. | ||
Data Flash Memory | Data EEPROM | Non-volatile data memory | Stores the user's application data. | |
Data Memory (RAM) | Data Memory | Partitioned into:
|
GPR are used for data storage. SFR are used for control and status of microcontroller and peripheral functions . Data memory stores the temporary application data. |
|
Configuration Bytes | Configuration Bytes | Device-specific configuration registers | Stores the configurations that are relevant to the device’s peripherals. | |
Device Configurations | Device Information Area (DIA) | Read operation through ICSP interface and NVM functions | Reserved for storing device specific information such as Unique ID and Calibration Data | Stores the device-specific configurations, which are read-only. Write access to these sections is prohibited. |
Data Configuration Information (DCI) | Contains the device-specific
information
|
|||
Device ID (Dev ID) | Contains the unique device ID | |||
Revision ID (Rev ID) | Contains the silicon revision of the device |
- The SAF Block is placed at the end of the PFM, and the size of this area depends on the SAFSZ configuration bits, which can vary across different devices in the 8-bit PIC microcontroller family. Refer to the respective device data sheets.
The program memory is further partitioned into the Application Block, the Boot Block and the SAF. The Application Block is where the user's application code resides. The Boot Block is ideal for storing bootloader code, and it must be enabled using the BBEN and BBSIZE Configuration bits. The Boot Block cannot be self-erased or self-written, and the code placed in the Boot Block can be executed by the CPU. SAF can be used as data storage, and it must be enabled using the SAFSZ Configuration bits. The code placed in the SAF area can never be executed by the CPU, which means that the SAF content cannot be modified, overwritten, or erased during operation. The Boot Block and the SAF area are not enabled by default, which means the entire program memory is configured as an Application Block and is available for the application code.
Data EEPROM is a non-volatile memory that can be used to store data. The Data EEPROM can be accessed during run-time, and only one byte of data can be read or written at a time.
The Configuration Bytes memory region comprises a collection of specialized registers that control the hardware features of the microcontroller. These features include clock source, Watchdog Timer (WDT), Brown-Out Detect (BOD), memory read/write operations, and code protection. The configuration bytes are not executable code and can be written only in Program mode. However, the configuration bytes can be read at run-time.
The User ID section can be used to store application-specific information such as product ID, checksum, and Cyclic Redundancy Check (CRC). This section does not have any level of protection, which means the contents of the section can be read, written to, or erased through the ICSP interface or Nonvolatile Memory (NVM) functions.
The Device Information Area (DIA) stores the calibration data for the Internal Temperature Indicator module, the Microchip Unique Identifier (MUI) words and the Fixed Voltage Reference (FVR) readings.
The Device Configuration Information (DCI) area in the program memory stores information about the device such as page erase size, number of write latches per row, number of user-erasable pages in program memory, data EEPROM size and microcontroller pin count. This information is useful for programming and bootloader applications.
The Device ID and Revision ID sections of memory hold the microcontroller’s device and revision identification details, respectively. In Program mode, this information is read through the ICSP interface.
The data stored in DIA, DCI, Device ID and Revision ID areas are read-only and cannot be erased or modified.