HLVD Power Down Save code example
This example demonstrates using an HLVD interrupt to quickly detect when power has been cut from the microcontroller.
About this Code Example
* HLVD Power Down Save code example for PIC18F46J11 at 3.3V.
* This example demonstrates using an HLVD interrupt to quickly
* detect when power has been cut from the microcontroller.
* While powered, the firmware simply increments a counter
* variable and displays the value on the serial port. When
* power is cut, the firmware quickly saves data to
* non-volatile FLASH memory during the short period of
* time where capacitors are keeping the microcontroller
* When power is restored, the firmware reads FLASH memory,
* finds the most recently stored data and restores state.
* The counter then continues where it left off.
* This example is intended to operate at 8MHz, which is the
* maximum speed for this part to operate down to the minimum
* Vdd specification. The minimum voltage for writing to FLASH
* is specified at 2.25V, but the write should still work if
* enough capacitance is provided to keep Vddcore up for the
* duration of the write.
- Jul 22, 2011
First upload to ECS