Microchip Technology ARD00385 Data Sheet

Page of 570
PIC18F87K90 FAMILY
DS39957D-page 404
 2009-2011 Microchip Technology Inc.
FIGURE 26-3:
HIGH-VOLTAGE DETECT OPERATION (VDIRMAG = 
1
)         
26.5
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
(Interrupt Service Routine), which would allow the
application to perform “housekeeping tasks” and a
controlled shutdown before the device voltage exits the
valid operating range at T
B
. This would give the appli-
cation a time window, represented by the difference
between T
A
 and T
B
, to safely exit.
FIGURE 26-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: