Setup

To set up the HLVD module:

  1. 1.Select the desired HLVD trip point by writing the value to the SEL bits of the HLVDCON1 register.
  2. 2.Depending on the application to detect high-voltage peaks or low-voltage drops or both, set the INTH or INTL bit appropriately.
  3. 3.Enable the HLVD module by setting the EN bit.
  4. 4.Clear the HLVD interrupt flag (HLVDIF), which may have been set from a previous interrupt.
  5. 5.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.