Microchip Technology MA160014 Hoja De Datos

Descargar
Página de 560
 2010-2012 Microchip Technology Inc.
DS41412F-page 351
PIC18(L)F2X/4XK22
23.3
HLVD Setup
To set up the HLVD module:
1.
Select the desired HLVD trip point by writing the
value to the HLVDL<3:0> bits.
2.
Set the VDIRMAG bit to detect high voltage
(VDIRMAG = 1) or low voltage (VDIRMAG = 0).
3.
Enable the HLVD module by setting the
HLVDEN bit.
4.
Clear the HLVD interrupt flag (PIR2<2>), which
may have been set from a previous interrupt.
5.
If interrupts are desired, enable the HLVD
interrupt by setting the HLVDIE and GIE/GIEH
bits (PIE2<2> and INTCON<7>, respectively). 
An interrupt will not be generated until the
IRVST bit is set.
23.4
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 
. 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.
23.5
HLVD Start-up Time
The internal reference voltage of the HLVD module,
specified in 
, 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 independent of device clock speed.
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 (see 
FIGURE 23-2:
LOW-VOLTAGE DETECT OPERATION (VDIRMAG = 0)    
Note:
Before changing any module settings
(V
DIRMAG
, HLVDL<3:0>), first disable the
module (HLVDEN = 0), make the changes
and re-enable the module. This prevents
the generation of false HLVD events.
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