Using High-Endurance Flash Memory

Some enhanced mid-range PIC® devices (PIC16F1XXX device family) lack the data EEPROM found on other devices. Instead, they implement an equivalent amount of special Flash memory that can provide an endurance comparable to that of a traditional data EEPROM. This High-Endurance Flash (HEF) memory appears in the regular program memory space and can be used for any purpose, like regular Flash program memory.

As with all Flash memory, data must be erased before it can be written and writing this memory will stall the device. Routines to read, write, and erase the HEF memory are available and they are described in the application note AN1673, Using the PIC16F1XXX HEF Block. You can also use MPLAB® Code Configurator (MCC) to generate the Flash access routines for you or use the output of this tool as the basis for your own code implementation.

Note that by default, the MPLAB XC8 C compiler will use HEF memory for regular executable code unless it is told otherwise. If you wish to store data here, you must reserve the HEF memory by using the —ROM compiler option, for example:


Or by placing the above argument (everything to the right of the = sign) in the ROM ranges field in the XC8 Linker > Memory Model category in the Project Properties dialog, if you are using MPLAB X IDE. Adjust the reserved memory range in these options as appropriate. You may wish to use only some HEF memory for data and the remainder for code.

© 2024 Microchip Technology, Inc.
Notice: ARM and Cortex are the registered trademarks of ARM Limited in the EU and other countries.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.