English
Language : 

PIC18F26K80-I Datasheet, PDF (77/622 Pages) Microchip Technology – 28/40/44/64-Pin, Enhanced Flash Microcontrollers with ECAN™ and nanoWatt XLP Technology
PIC18F66K80 FAMILY
4.7 Ultra Low-Power Wake-up
The Ultra Low-Power Wake-up (ULPWU) on pin, RA0,
allows a slow falling voltage to generate an interrupt
without excess current consumption.
To use this feature:
1. Charge the capacitor on RA0 by configuring the
RA0 pin to an output and setting it to ‘1’.
2. Stop charging the capacitor by configuring RA0
as an input.
3. Discharge the capacitor by setting the ULPEN
and ULPSINK bits in the WDTCON register.
4. Configure Sleep mode.
5. Enter Sleep mode.
When the voltage on RA0 drops below VIL, the device
wakes up and executes the next instruction.
This feature provides a low-power technique for
periodically waking up the device from Sleep mode.
The time-out is dependent on the discharge time of the
RC circuit on RA0.
When the ULPWU module wakes the device from
Sleep mode, the ULPLVL bit (WDTCON<5>) is set.
Software can check this bit upon wake-up to determine
the wake-up source.
See Example 4-1 for initializing the ULPWU module.
EXAMPLE 4-1:
ULTRA LOW-POWER
WAKE-UP INITIALIZATION
//***************************
//Charge the capacitor on RA0
//***************************
TRISAbits.TRISA0 = 0;
PORTAbits.RA0 = 1;
for(i = 0; i < 10000; i++) Nop();
//*****************************
//Stop Charging the capacitor
//on RA0
//*****************************
TRISAbits.TRISA0 = 1;
//*****************************
//Enable the Ultra Low Power
//Wakeup module and allow
//capacitor discharge
//*****************************
WDTCONbits.ULPEN = 1;
WDTCONbits.ULPSINK = 1;
//For Sleep
OSCCONbits.IDLEN = 0;
//Enter Sleep Mode
//
Sleep();
//for sleep, execution will
//resume here
A series resistor, between RA0 and the external
capacitor, provides overcurrent protection for the RA0/
CVREF/AN0/ULPWU pin and enables software
calibration of the time-out (see Figure 4-9).
FIGURE 4-9:
ULTRA LOW-POWER
WAKE-UP INITIALIZATION
RA0/CVREF/AN0/ULPWU
A timer can be used to measure the charge time and
discharge time of the capacitor. The charge time can
then be adjusted to provide the desired delay in Sleep.
This technique compensates for the affects of
temperature, voltage and component accuracy. The
peripheral can also be configured as a simple
programmable Low-Voltage Detect (LVD) or temperature
sensor.
Note:
For more information, see AN879, “Using
the Microchip Ultra Low-Power Wake-up
Module” (DS00879).
 2010-2012 Microchip Technology Inc.
DS39977F-page 77