38.2 Setup
To set up the HLVD module:
- Select the desired HLVD trip point by writing the value to the SEL bits.
- Depending on the application to detect high-voltage peaks or low-voltage drops or both, set the INTH or INTL bit appropriately.
- Enable the HLVD module by setting the EN bit.
- Clear the HLVD Interrupt Flag (HLVDIF), which may have been set from a previous interrupt.
- If interrupts are desired, enable the HLVD interrupt by setting
the HLVDIE and GIE bits.
An interrupt will not be generated until the RDY bit is set.
Important: Before changing any module settings (interrupts and tripping point), first disable the module (EN =0
), make the changes and re-enable the module. This prevents the generation of false HLVD events.