15 NVM - Nonvolatile Memory Control

The Nonvolatile Memory (NVM) module provides run-time read and write access to the Program Flash Memory (PFM) and Configuration bits. PFM includes the program memory and user ID space.

NVM is accessible using both FSR and INDF registers, or through the NVMREG register interface (see Table 15-1).

The write time is controlled by an on-chip timer. The write/erase voltages are generated by an on-chip charge pump rated to operate over the operating voltage range of the device.

PFM can be protected in two ways: code protection and write protection. Code protection (Configuration bit CP) disables PFM read and write access through an external device programmer. Write protection prevents user software writes to NVM areas tagged for protection by the WRTn Configuration bits. Code protection does not affect the self-write and erase functionality, whereas write protection does. Attempts to write a protected location will set the WRERR bit. Code protection and write protection can only be reset on a Bulk Erase performed by an external programmer.

The Bulk Erase command is used to completely erase program memory. The Bulk Erase command can only be issued through an external programmer. There is no run time access for this command.

If the device is code-protected and a Bulk Erase command for the configuration memory is issued; all other memory regions are also erased. Refer to the ”Programming Specifications” document for more details.

Table 15-1. NVM Organization and Access Information
Main ValuesNVMREG AccessFSR Access
Memory FunctionMemory TypeProgram Counter (PC), ICSP™ AddressNVMREGS bit (NVMCON1)NVMADR[14:0]Allowed OperationsFSR AddressFSR Programming Access
Reset VectorProgram Flash Memory0x000000x0000Read/Write0x8000Read-Only
User Memory0x000100x00010x8001
0x00030x00030x8003
INT Vector0x000400x00040x8004
User Memory0x000500x00050x8005
0x3FFF(1)0x3FFF(1)0xFFFF
User IDProgram Flash Memory0x800010x0000Read/WriteNo Access
0x80030x0003
Reserved0x0004
Revision IDHard Coded in Program Flash Memory0x800510x0005Read
Device ID0x800610x0006
CONFIG1Program Flash Memory0x800710x0007Read/Write
CONFIG20x800810x0008
CONFIG30x800910x0009
CONFIG40x800A10x000A
CONFIG50x800B10x000B
DIA and DCIHard Coded in Program Flash Memory0x810010x0100Read
0x82FF10x02FF
Note:
  1. The maximum Program Flash Memory address for the PIC16F152 family is 0x3FFF.