PIC18F1230/1330
2009 Microchip Technology Inc.
DS39758D-page 189
19.2
LVD Setup
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 LVDL3:LVDL0 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
(PIE2<2> and INTCON<7>). An interrupt will not
be generated until the IRVST bit is set.
19.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.
19.4
LVD Start-up Time
The internal reference voltage of the LVD module,
specified in electrical specification parameter
D420,may be used by other internal circuitry, such as the
programmable Brown-out Reset. If the LVD 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-voltage condition can be reliably detected. This
start-up time, TIRVST, is an interval that is independent
of device clock speed. It is specified in electrical
specification parameter
36.The LVD interrupt flag is not enabled until TIRVST 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 19-2).
FIGURE 19-2:
LOW-VOLTAGE DETECT OPERATION
VLVD
VDD
LVDIF
VLVD
VDD
Enable LVD
TIRVST
LVDIF may not be set
Enable LVD
LVDIF
LVDIF cleared in software
LVDIF cleared in software,
CASE 1:
CASE 2:
LVDIF remains set since LVD condition still exists
TIRVST
Internal reference is stable
IRVST