English
Language : 

PIC18LF24K Datasheet, PDF (471/594 Pages) –
PIC18(L)F26/45/46K40
33.0 HIGH/LOW-VOLTAGE DETECT
(HLVD)
The PIC18(L)F2x/4xK40 of devices has a High/Low-
Voltage Detect module (HLVD). This is a programmable
circuit that sets both a device voltage trip point and the
direction of change from that point (positive going, neg-
ative going or both). If the device experiences an excur-
sion past the trip point in that direction, an interrupt flag
is set. If the interrupt is enabled, the program execution
branches to the interrupt vector address and the soft-
ware responds to the interrupt.
Complete control of the HLVD module is provided
through the HLVDCON0 and HLVDCON1 register. This
allows the circuitry to be “turned off” by the user under
software control, which minimizes the current
consumption for the device.
The module’s block diagram is shown in Figure 33-1.
Since the HLVD can be software enabled through the
HLVDEN bit, setting and clearing the enable bit does
not produce a false HLVD event glitch. Each time the
HLVD module is enabled, the circuitry requires some
time to stabilize. The RDY bit (HLVDCON0<4>) is a
read-only bit used to indicate when the band gap
reference voltages are stable.
The module can only generate an interrupt after the
module is turned ON and the band gap reference
voltages are ready.
The HLVDINTH and HLVDINTL bits determine the
overall operation of the module. When HLVDINTH is
set, the module monitors for rises in VDD above the trip
point set by the HLVDCON1 register. When HLVDINTL
is set, the module monitors for drops in VDD below the
trip point set by the HLVDCON1 register. When both
the HLVDINTH and HLVDINTL bits are set, any
changes above or below the trip point set by the
HLVDCON1 register can be monitored.
The OUT bit can be read to determine if the voltage is
greater than or less than the voltage level selected by
the HLVDCON1 register.
33.1 Operation
When the HLVD module is enabled, a comparator uses
an internally generated voltage reference as the set
point. The set point is compared with the trip point,
where each node in the resistor divider represents a
trip point voltage. The “trip point” voltage is the voltage
level at which the device detects a high or low-voltage
event, depending on the configuration of the module.
When the supply voltage is equal to the trip point, the
voltage tapped off of the resistor array is equal to the
internal reference voltage generated by the voltage
reference module. The comparator then generates an
interrupt signal by setting the HLVDIF bit.
The trip point voltage is software programmable to any of
16 values. The trip point is selected by programming the
HLVDSEL<3:0> bits (HLVDCON1<3:0>).
FIGURE 33-1:
HLVD MODULE BLOCK DIAGRAM
VDD
4 HLVDSEL<3:0>
HLVDEN
HLVDEN
HLVDOUT
-
Trigger/
Interrupt
+
Generation
HLVDRDY HLVDINTH HLVDINTL
HLVDIF
Bandgap
Reference
Volatge
 2016 Microchip Technology Inc.
Preliminary
DS40001816C-page 471