English
Language : 

PIC18LF24K Datasheet, PDF (472/594 Pages) –
PIC18(L)F26/45/46K40
33.2 HLVD Setup
To set up the HLVD module:
1. Select the desired HLVD trip point by writing the
value to the HLVDSEL<3:0> bits of the
HLVDCON1 register.
2. Depending on the application to detect
high-voltage peaks or low-voltage drops or both,
set the HLVDINTH or HLVDINTL bit
appropriately.
3. Enable the HLVD module by setting the
HLVDEN bit.
4. Clear the HLVD interrupt flag (PIR2 register),
which may have been set from a previous inter-
rupt.
5. If interrupts are desired, enable the HLVD
interrupt by setting the HLVDIE in the PIE2
register and GIE bits.
An interrupt will not be generated until the
HLVDRDY bit is set.
Note:
Before changing any module settings
(HLVDINTH, HLVDINTL, HLVDSEL<3:0>),
first disable the module (HLVDEN = 0),
make the changes and re-enable the
module. This prevents the generation of
false HLVD events.
33.3 Current Consumption
When the module is enabled, the HLVD comparator
and voltage divider are enabled and consume static
current. The total current consumption, when enabled,
is specified in electrical specification Parameter D206
(Table 37-3).
Depending on the application, the HLVD module does
not need to operate constantly. To reduce current
requirements, the HLVD circuitry may only need to be
enabled for short periods where the voltage is checked.
After such a check, the module could be disabled.
33.4 HLVD Start-up Time
The internal reference voltage of the HLVD module,
specified in electrical specification (Table 37-17), may
be used by other internal circuitry, such as the
programmable Brown-out Reset. If the HLVD or other
circuits using the voltage reference are disabled to
lower the device’s current consumption, the reference
voltage circuit will require time to become stable before
a low or high-voltage condition can be reliably
detected. This start-up time, TFVRST, is an interval that
is independent of device clock speed. It is specified in
electrical specification (Table 37-17).
The HLVD interrupt flag is not enabled until TFVRST has
expired and a stable reference voltage is reached. For
this reason, brief excursions beyond the set point may
not be detected during this interval (see Figure 33-2 or
Figure 33-3).
 2016 Microchip Technology Inc.
Preliminary
DS40001816C-page 472