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 High-Endurance Flash (HEF) Block. You can also use the 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:

—ROM=default,-1f80-1fff

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.

20th Annual
Microchip MASTERs Conference 2016

JW Marriott Desert Ridge Resort-Phoenix, AZ

© 2016 Microchip Technology, Inc.
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.