PIC18F2331/2431/4331/4431
22.1 Operation
22.2 LVD Setup
When the LVD module is enabled, a comparator uses
an internally generated reference voltage 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 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 LVDIF bit.
The following steps are needed to set up the LVD
module:
1. Disable the module by clearing the LVDEN bit
(LVDCON<4>).
2. Write the value to the LVDL<3:0> bits that
selects the desired LVD trip point.
3. Enable the LVD module by setting the LVDEN
bit.
4. Clear the LVD interrupt flag (PIR2<2>), which
may have been set from a previous interrupt.
5. Enable the LVD interrupt, if interrupts are
desired, by setting the LVDIE and GIE bits
(PIE<2> and INTCON<7>).
The trip point voltage is software programmable to any
one of 16 values, selected by programming the
LVDL<3:0> bits (LVDCON<3:0>).
An interrupt will not be generated until the IRVST bit is set.
The LVD module has an additional feature that allows
the user to supply the trip voltage to the module from an
external source. This mode is enabled when bits,
LVDL<3:0>, are set to ‘1111’. In this state, the compar-
ator input is multiplexed from the external input pin,
LVDIN. This gives users flexibility because it allows
them to configure the Low-Voltage Detect interrupt to
occur at any voltage in the valid operating range.
22.3 Current Consumption
When the module is enabled, the LVD comparator and
voltage divider are enabled and will consume static cur-
rent. The total current consumption, when enabled, is
specified in electrical specification Parameter D022B.
Depending on the application, the LVD module does
not need to be operating constantly. To decrease the
current requirements, the LVD circuitry may only need
to be enabled for short periods where the voltage is
checked. After doing the check, the LVD module may
be disabled.
2010 Microchip Technology Inc.
DS39616D-page 259