Microchip Technology GPIODM-KPLCD Data Sheet

Page of 438
© 2009 Microchip Technology Inc.
 
DS39632E-page 287
PIC18F2455/2550/4455/4550
24.2
HLVD Setup
The following steps are needed to set up the HLVD
module:
1.
Disable the module by clearing the HLVDEN bit
(HLVDCON<4>).
2.
Write the value to the HLVDL3:HLVDL0 bits that
selects the desired HLVD trip point.
3.
Set the VDIRMAG bit to detect high voltage
(VDIRMAG = 1) or low voltage (VDIRMAG = 0).
4.
Enable the HLVD module by setting the
HLVDEN bit.
5.
Clear the HLVD Interrupt Flag, HLVDIF
(PIR2<2>), which may have been set from a
previous interrupt.
6.
Enable the HLVD interrupt, if interrupts are
desired, by setting the HLVDIE and GIE/GIEH
bits (PIE2<2> and INTCON<7>). An interrupt
will not be generated until the IRVST bit is set.
24.3
Current Consumption
When the module is enabled, the HLVD comparator
and voltage divider are enabled and will consume static
current. The total current consumption, when enabled,
is specified in electrical specification parameter D022
(Section  28.2 “DC Characteristics”).
Depending on the application, the HLVD module does
not need to be operating constantly. To decrease the
current requirements, the HLVD circuitry may only
need to be enabled for short periods where the voltage
is checked. After doing the check, the HLVD module
may be disabled.
24.4
HLVD Start-up Time
The internal reference voltage of the HLVD module,
specified in electrical specification parameter D420 (see
Table 28-6 in Section 28.0 “Electrical Characteris-
tics”
), 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, T
IRVST
, is an interval that is indepen-
dent of device clock speed. It is specified in electrical
specification parameter 36 (Table 28-12). 
The HLVD interrupt flag is not enabled until T
IRVST
 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. Refer to
Figure 24-2 or Figure 24-3.
FIGURE 24-2:
LOW-VOLTAGE DETECT OPERATION (VDIRMAG = 
0
)    
V
HLVD
V
DD
HLVDIF
V
HLVD
V
DD
Enable HLVD
T
IRVST
HLVDIF may not be set
Enable HLVD
HLVDIF
HLVDIF cleared in software
HLVDIF cleared in software
HLVDIF cleared in software, 
CASE 1:
CASE 2:
HLVDIF remains set since HLVD condition still exists
T
IRVST
Internal Reference is stable
Internal Reference is stable
IRVST
IRVST