Microchip Technology MA160014 Data Sheet

Page of 560
PIC18(L)F2X/4XK22
DS41412F-page 352
 2010-2012 Microchip Technology Inc.
FIGURE 23-3:
HIGH-VOLTAGE DETECT OPERATION (VDIRMAG = 
1
)         
23.6
Applications
In many applications, it is desirable to detect a drop
below, or rise above, a particular voltage threshold. For
example, the HLVD module could be periodically
enabled to detect Universal Serial Bus (USB) attach or
detach. This assumes the device is powered by a lower
voltage source than the USB when detached. An attach
would indicate a high-voltage detect from, for example,
3.3V to 5V (the voltage on USB) and vice versa for a
detach. This feature could save a design a few extra
components and an attach signal (input pin).
For general battery applications, 
 shows a
possible voltage curve. Over time, the device voltage
decreases. When the device voltage reaches voltage
V
A
, the HLVD logic generates an interrupt at time, T
A
.
The interrupt could cause the execution of an ISR,
which would allow the application to perform “house-
keeping tasks” and a controlled shutdown before the
device voltage exits the valid operating range at T
B
.
This would give the application a time window,
represented by the difference between T
A
 and T
B
, to
safely exit.
FIGURE 23-4:
TYPICAL LOW-VOLTAGE 
DETECT APPLICATION      
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
IRVST
Internal Reference is stable
Internal Reference is stable
IRVST
Time
Vo
lt
a
g
e
V
A
V
B
T
A
T
B
V
A
 = HLVD trip point
V
B
 = Minimum valid device
         operating voltage
Legend: