100% found this document useful (1 vote)
124 views12 pages

PIC Microcontroller Low Power Tips N Tricks Chapter 2 UTIL

Uploaded by

Branco8
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
100% found this document useful (1 vote)
124 views12 pages

PIC Microcontroller Low Power Tips N Tricks Chapter 2 UTIL

Uploaded by

Branco8
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 12

PIC® Microcontroller Low Power Tips ‘n Tricks

CHAPTER 2
PIC® Microcontroller Low Power
Tips ‘n Tricks

Table Of Contents TIPS ‘N TRICKS INTRODUCTION


Microchip continues to provide innovative
products that are smaller, faster, easier to
GENERAL LOW POWER TIPS ‘N TRICKS
use and more reliable. The Flash-based PIC®
TIP #1 Switching Off External Circuits/ microcontrollers (MCUs) are used in an wide
Duty Cycle........................................... 2-2
range of everyday products, from smoke
TIP #2 Power Budgeting................................. 2-3 detectors, hospital ID tags and pet containment
TIP #3 Configuring Port Pins.......................... 2-4 systems, to industrial, automotive and medical
TIP #4 Use High-Value Pull-Up Resistors....... 2-4 products.
TIP #5 Reduce Operating Voltage.................. 2-4
TIP #6 Use an External Source for PIC MCUs featuring nanoWatt technology
CPU Core Voltage............................... 2-5 implement a variety of important features which
TIP #7 Battery Backup for PIC MCUs . .......... 2-6 have become standard in PIC microcontrollers.
Since the release of nanoWatt technology,
DYNAMIC OPERATION TIPS ‘N TRICKS changes in MCU process technology and
TIP #8 Enhanced PIC16 Mid-Range Core...... 2-6 improvements in performance have resulted in
TIP #9 Two-Speed Start-Up............................ 2-7 new requirements for lower power. PIC MCUs
TIP #10 Clock Switching................................... 2-7 with nanoWatt eXtreme Low Power (nanoWatt
TIP #11 Use Internal RC Oscillators................. 2-7 XLP™) improve upon the original nanoWatt
TIP #12 Internal Oscillator Calibration.............. 2-8 technology by dramatically reducing static
TIP #13 Idle and Doze Modes.......................... 2-8 power consumption and providing new flexibility
TIP #14 Use NOP and Idle Mode....................... 2-9 for dynamic power management.
TIP #15 Peripheral Module Disable The following series of Tips n’ Tricks can be
(PMD) Bits........................................... 2-9
applied to many applications to make the most
STATIC POWER REDUCTION TIPS ‘N TRICKS of PIC MCU nanoWatt and nanoWatt XLP
TIP #16 Deep Sleep Mode................................ 2-10 devices.
TIP #17 Extended WDT and Deep
Sleep WDT.......................................... 2-10 GENERAL LOW POWER TIPS ‘N
TIP #18 Low Power Timer1 Oscillator TRICKS
and RTCC........................................... 2-10
TIP #19 Low Power Timer1 Oscillator Layout... 2-11 The following tips can be used with all PIC
TIP #20 Use LVD to Detect Low Battery........... 2-11 MCUs to reduce the power consumption of
TIP #21 Use Peripheral FIFO and DMA............ 2-11 almost any application.
TIP #22 Ultra Low-Power
Wake-Up Peripheral............................ 2-12

© 2009 Microchip Technology Inc. DS01146B-Page 2-1


PIC® Microcontroller Low Power Tips ‘n Tricks

TIP #1 Switching Off External Example:


Circuits/Duty Cycle The application is a long duration data recorder.
All the low power modes in the world won’t help It has a sensor, an EEPROM, a battery and a
your application if you are unable to control microprocessor. Every two seconds, it must
the power used by circuits external to the take a sensor reading, scale the sensor data,
microprocessor. Lighting an LED is equivalent store the scaled data in EEPROM and wait for
to running most PIC MCUs at 5V-20 MHz. the next sensor reading.
When you are designing your circuitry, decide
what physical modes or states are required and
partition the electronics to shutdown unneeded
circuitry.
Figure: 1-1
C2

0.1 µF
U1

VDD
100k

R2

R4
10k

10k
R5
MCLR
RA0 RB0/INT
U2
R3
RA1 RB1 VCC A0

3.3V 1k RA2 RB2 WP A1


0.1 µF

C1

RA3 RB3 SCL A2


RA4/TOCKI RB4 SDA GND
RB5
Serial EEPROM
OSC1/CLKIN RB6 Y1
22 pF

R1 OSC2/CLKOUT RB7
C3

100k VSS 32.768 kHz


33 pF

33 pF
C5
C4

PIC16F819

The system shown above is very simple In Figure 1-2, I/O pins are used to power the
and clearly has all the parts identified in the EEPROM and the sensor. Many PIC MCU
requirements. Unfortunately, it has a few devices can source up to 20 mA of current
problems in that the EEPROM, the sensor, and from each I/O, so there is no need to provide
its bias circuit, are energized all the time. To additional components to switch the power.
get the minimum current draw for this design, If more current than can be sourced by the PIC
it would be advantageous to shutdown these MCU is required, the PIC MCU can instead
circuits when they are not required. enable and disable a MOSFET to power
Figure: 1-2 the circuit. Refer to the data sheet for drive
capabilities for a specific device.
C2

0.1 µF
U1

VDD
100k

R5

R4
10k
R2

10k

MCLR
RA0 RB0/INT
U2
R3
RA1 RB1 VCC A0
1k RA2 RB2 WP A1
3.3V
0.1 µF

C1

RA3 RB3 SCL A2


RA4/TOCKI RB4 SDA GND
RB5
Serial EEPROM
OSC1/CLKIN RB6 Y1
22 pF

R1 OSC2/CLKOUT RB7
C3

100k VSS 32.768 kHz


33 pF
33 pF

C5
C4

PIC16F819

Page 2-2-DS01146B © 2009 Microchip Technology Inc.


PIC® Microcontroller Low Power Tips ‘n Tricks

TIP #2 Power Budgeting Computing Battery Life


Power budgeting is a technique that is critical to Using the average current from the calculated
predicting current consumption and battery life. power budget, it is possible to determine
Power budgeting is performed by calculating how long a battery will be able to power the
the total charge for each mode of operation application. Table 2 shows lifetimes for typical
of an application by multiplying that mode’s battery types using the average power from
current consumption by the time in the mode Table 1.
for a single application loop. The charge for
Life
each mode is added, then averaged over the Battery
Capacity
(mAh)
total loop time to get average current. Table 1 Hours Days Months Years
calculates a power budget using the application CR1212 18 4180 174 5.8 .48
from Figure 2 in Tip #1 using a typical nanoWatt CR1620 75 17417 726 24.2 1.99
XLP device. CR2032 220 51089 2129 71.0 5.83
Time Current (mA) Charge Alkaline AAA 1250 290276 12095 403.2 33.14
in Current *
Mode By Mode Alkaline AA 2890 671118 27963 932.1 76.61
Mode Time
(mS) Device Total (mA * Sec) Li-ion* 850 197388 8224 274.1 22.53
Sleep NOTE: Calculations are based on average current draw only and
MCU Sleep 0.00005 do not include battery self-discharge.
Sensor Off 1989 0 5.00E-05 9.95E-05
EEPROM Off 0 *Varies by size; value used is typical.
Initialize
MCU Sleep 0.00005
After completing a power budget, it is very easy
Sensor On 1 0.0165 1.66E-02 1.66E-05 to determine the battery size required to meet
EEPROM Off 0 the application requirements. If too much power
Sample Sensor is consumed, it is simple to determine where
MCU Run 0.048
Sensor On 1 0.0165 6.45E-02 6.45E-05 additional effort needs to be placed to reduce
EEPROM Off 0 the power consumption.
Scaling
MCU Run 0.048
Sensor Off 1 0 4.80E-02 4.80E-05
EEPROM Off 0
Storing
MCU Run 0.048
Sensor Off 8 0 1.05E+00 8.38E-03
EEPROM On 1

Total 2000 — — 8.61E-03

Average Current

= 8.61e-3 mA*Sec
2000e-3 Sec

= 0.0043 mA

Peak Current 1.05 mA

© 2009 Microchip Technology Inc. DS01146B-Page 2-3


PIC® Microcontroller Low Power Tips ‘n Tricks

TIP #3 Configuring Port Pins TIP #4 Use High-Value Pull-Up


All PIC MCUs have bidirectional I/O pins. Some Resistors
of these pins have analog input capabilities. It It is more power efficient to use larger pull-up
is very important to pay attention to the signals resistors on I/O pins such as MCLR, I2C™
applied to these pins so the least amount of signals, switches and for resistor dividers. For
power will be consumed. example, a typical I2C pull-up is 4.7k. However,
Unused Port Pins when the I2C is transmitting and pulling a line
low, this consumes nearly 700 uA of current for
If a port pin is unused, it may be left each bus at 3.3V. By increasing the size of the
unconnected but configured as an output pin I2C pull-ups to 10k, this current can be halved.
driving to either state (high or low), or it may The tradeoff is a lower maximum I2C bus
be configured as an input with an external speed, but this can be a worthwhile trade in for
resistor (about 10 kΩ) pulling it to Vdd or Vss. many low power applications. This technique is
If configured as an input, only the pin input especially useful in cases where the pull-up can
leakage current will be drawn through the be increased to a very high resistance such as
pin (the same current would flow if the pin 100k or 1M.
was connected directly to Vdd or Vss). Both
options allow the pin to be used later for either
TIP #5 Reduce Operating Voltage
input or output without significant hardware Reducing the operating voltage of the device,
modifications. Vdd, is a useful step to reduce the overall
power consumption. When running, power
Digital Inputs
consumption is mainly influenced by the clock
A digital input pin consumes the least amount speed. When sleeping, the most significant
of power when the input voltage is near Vdd factor is leakage in the transistors. At lower
or Vss. If the input voltage is near the midpoint voltages, less charge is required to switch the
between Vdd and Vss, the transistors inside the system clocks and transistors leak less current.
digital input buffer are biased in a linear region
It is important to pay attention to how reducing
and they will consume a significant amount
the operating voltage reduces the maximum
of current. If such a pin can be configured as
allowed operating frequency. Select the
an analog input, the digital buffer is turned off,
optimum voltage that allows the application
reducing both the pin current as well as the total
to run at its maximum speed. Refer to the
controller current.
device data sheet for the maximum operating
Analog Inputs frequency of the device at the given voltage.
Analog inputs have a very high-impedance
so they consume very little current. They
will consume less current than a digital input
if the applied voltage would normally be
centered between Vdd and Vss. Sometimes it
is appropriate and possible to configure digital
inputs as analog inputs when the digital input
must go to a low power state.
Digital Outputs
There is no additional current consumed by a
digital output pin other than the current going
through the pin to power the external circuit.
Pay close attention to the external circuits to
minimize their current consumption.

Page 2-4-DS01146B © 2009 Microchip Technology Inc.


PIC® Microcontroller Low Power Tips ‘n Tricks

TIP #6 Use an External Source for Example 2: Non-Constant Voltage Source


CPU Core Voltage If the source for Vdd is not constant, a regulator
Some PIC MCUs such as “J” type devices (ex. will be required. It can be beneficial to use an
PIC18F87J90 or PIC24FJ64GA004) use sepa- external low quiescent current regulator, which
rate power for CPU core. These devices have can be selected to provide lower voltage to the
an internal voltage regulator that can be used to core than the internal regulator. Additionally,
provide the core voltage. Alternatively, the core devices such as the MCP1700, which
voltage can be provided externally by disabling consumes 1 uA quiescent current while asleep,
the internal regulator. In some cases, it is more require less power than the internal regulator.
power efficient to use an external source for Figure 6-2:
the core. This is because the internal regula-
tor powers the core at the nominal voltage that ®

allows full speed operation. However, if an


application doesn’t require full speed, it is ben-
eficial to use lower voltage to power the core.
Disabling the internal regulator also turns off the
BOR and LVD circuits, which saves power as
well. The following examples show two different
battery powered applications where it can be
beneficial to disable the internal regulator.
Example 1: Constant Voltage Source
When using a regulated power source or a
battery with a flat discharge curve, such as a
lithium coin cell, the regulator can be disabled
and the core powered directly from the battery
through a diode. The diode provides the
voltage drop necessary to power the core at the
correct voltage. It may be necessary to use a
zener diode with a higher forward voltage for
applications using sleep mode, as the current
consumed in sleep is too low to cause the
full forward voltage drop which can result in
applying a voltage too high for the core.
Figure 6-1:

© 2009 Microchip Technology Inc. DS01146B-Page 2-5


PIC® Microcontroller Low Power Tips ‘n Tricks

TIP #7 Battery Backup for PIC MCUs Dynamic Operation Tips n’ Tricks
For an application that can operate from either The following tips and tricks apply to methods
an external supply or a battery backup, it is of improving the dynamic operating current
necessary to be able to switch from one to consumption of an application. This allows
the other without user intervention. This can an application to get processing done quicker
be accomplished with battery backup ICs, but which enables it to sleep more and will help
it is also possible to implement with a simple reduce the current consumed while processing.
diode OR circuit, shown in Figure 7-1. Diode D1
prevents current from flowing into the battery TIP #8 Enhanced PIC16 Mid-Range
from VEXT when the external power is sup- Core
plied. D2 prevents current from flowing into any The Enhanced PIC16 mid-range core has a few
external components from the battery if VEXT features to assist in low power. New instructions
is removed. As long as the external source is allow many applications to execute in less
present and higher voltage than the battery, time. This allows the application to spend more
no current from the battery will be used. When time asleep and less time processing and
VEXT is removed and the voltage drops below can provide considerable power savings. It is
VBAT, the battery will start powering the MCU. important not to overlook these new instructions
Low forward voltage Schottky diodes can be when designing with devices that contain the
used in order to minimize the voltage dropout new core. The Timer1 oscillator and WDT have
from the diodes. Additionally, inputs can be ref- also been improved, now meeting nanoWatt
erenced to VEXT and VBAT in order to monitor XLP requirements and drawing much less
the voltage levels of the battery and the exter- current than in previous devices.
nal supply. This allows the micro to enter lower
power modes when the supply is removed or
the battery is running low. In order to avoid
glitches on Vdd caused by the diode turn-on
delay when switching supplies, ensure enough
decoupling capacitance is used on Vdd (C1).
Figure 7-1:










Page 2-6-DS01146B © 2009 Microchip Technology Inc.


PIC® Microcontroller Low Power Tips ‘n Tricks

TIP #9 Two-Speed Start-Up TIP #10 Clock Switching


Two-speed startup is a useful feature on some Some nanoWatt devices and all nanoWatt XLP
nanoWatt and all nanoWatt XLP devices which devices have multiple internal and external
helps reduce power consumption by allowing clock sources, as well as logic to allow switching
the device to wake up and return to sleep between the available clock sources as the
faster. Using the internal oscillator, the user can main system clock. This allows for significant
execute code while waiting for the Oscillator power savings by choosing different clocks
Start-up (OST) timer to expire (LP, XT or HS for different portions of code. For example, an
modes). This feature (called “Two-Speed Start- application can use the slower internal oscillator
up”) is enabled using the IESO configuration when executing non-critical code and then
bit. A Two-Speed Start-up will clock the device switch to a fast high-accuracy oscillator for time
from an internal RC oscillator until the OST has or frequency sensitive code. Clock switching
expired. Switching to a faster internal oscillator allows much more flexible applications than
frequency during start-up is also possible using being stuck with a single clock source. Clock
the OSCCON register. The example below switching sequences vary by device family, so
shows several stages on how this can be refer to device data sheets or Family Reference
achieved. The number of frequency changes Manuals for the specific clock switching
is dependent upon the designer’s discretion. sequences.
Assume a 20 MHz crystal (HS Mode) in the
PIC16F example below. TIP #11 Use Internal RC Oscillators
Example: If frequency precision better than ±5% is not
Tcy required, it is best to utilize the internal RC
(Instruction Time) Instruction oscillators inside all nanoWatt and nanoWatt
ORG 0x05 ;Reset vector XLP devices. The internal RC oscillators have
better frequency stability than external RC
125 ms @ 32 kHz BSF STATUS,RP0 ;bank1 oscillators, and consume less power than
125 ms @ 32 kHz BSF OSCCON,IRCF2 ;switch to 1 MHz external crystal oscillators. Additionally, the
internal clock can be configured for many
4 ms @ 1 MHz BSF OSCCON,IRCF1 ;switch to 4 MHz frequency ranges using the internal PLL module
to increase frequency and the postscaler to
1 ms @ 4 MHz BSF OSCCON,IRCF0 ;switch to 8 MHz reduce it. All these options can be configured in
firmware.
500 ns application code
500 ns application code
… ….
.. …
(eventually OST expires, 20 MHz crystal clocks the device)

200 ns application code


… ….
.. …

© 2009 Microchip Technology Inc. DS01146B-Page 2-7


PIC® Microcontroller Low Power Tips ‘n Tricks

TIP #12 Internal Oscillator Calibration TIP #13 Idle and Doze Modes
An internal RC oscillator calibrated from the nanoWatt and nanoWatt XLP devices have
factory may require further calibration as the an Idle mode where the clock to the CPU is
temperature or Vdd change. Timer1/SOSC can disconnected and only the peripherals are
be used to calibrate the internal oscillator by clocked. In PIC16 and PIC18 devices, Idle
connecting a 32.768 kHz clock crystal. Refer mode can be entered by setting the Idle bit in
to AN244, “Internal RC Oscillator Calibration” the OSCON register to ‘1’ and executing the
for the complete application details. Calibrating SLEEP instruction. In PIC24, dsPIC® DSCs,
the internal oscillator can help save power by and PIC32 devices, Idle mode can be entered
allowing for use of the internal RC oscillator by executing the instruction “PWRSAV #1”. Idle
in applications which normally require higher mode is best used whenever the CPU needs to
accuracy crystals wait for an event from a peripheral that cannot
operate in Sleep mode. Idle mode can reduce
Figure 12-1: Timer1 Used to Calibrate an power consumption by as much as 96% in
Internal Oscillator many devices.
PIC16F818/819 Doze mode is another low power mode
available in PIC24, dsPIC DSCs, and PIC32
C1
33 pF devices. In Doze mode, the system clock to
T1OSI the CPU is postscaled so that the CPU runs at
a lower speed than the peripherals. If the CPU
XTAL is not tasked heavily and peripherals need to
32.768 kHz
run at high speed, then Doze mode can be
T1OSO used to scale down the CPU clock to a slower
C2 frequency. The CPU clock can be scaled down
33 pF from 1:1 to 1:128. Doze mode is best used in
similar situations to Idle mode, when peripheral
The calibration is based on the measured operation is critical, but the CPU only requires
frequency of the internal RC oscillator. For minimal functionality.
example, if the frequency selected is 4 MHz,
we know that the instruction time is 1 µs
(Fosc/4) and Timer1 has a period of 30.5 µs
(1/32.768 kHz). This means within one Timer1
period, the core can execute 30.5 instructions.
If the Timer1 registers are preloaded with a
known value, we can calculate the number of
instructions that will be executed upon a Timer1
overflow.
This calculated number is then compared
against the number of instructions executed by
the core. With the result, we can determine if
re-calibration is necessary, and if the frequency
must be increased or decreased. Tuning uses
the OSCTUNE register, which has a ±12%
tuning range in 0.8% steps.

Page 2-8-DS01146B © 2009 Microchip Technology Inc.


PIC® Microcontroller Low Power Tips ‘n Tricks

TIP #14 Use NOP and Idle Mode TIP #15 Peripheral Module Disable
When waiting on a blocking loop (e.g. waiting (PMD) Bits
for an interrupt), instead put the device into PIC24, dsPIC DSCs, and PIC32 devices
Idle mode to disable the CPU. The peripheral have PMD bits that can be used to disable
interrupt will wake up the device. Idle mode peripherals that will not be used in the
consumes much less current than constantly application. Setting these bits disconnects
reading RAM and jumping back. If the CPU all power to the module as well as SFRs for
cannot be disabled because the loop required the module. Because power is completely
some calculations, such as incrementing a removed, the PMD bits offer additional power
counter, instead of doing a very tight loop savings over disabling the module by turning
that loops many times, add NOPs into the off the module’s enable bit. These bits can be
loop. See the code example below. A NOP dynamically changed so that modules which are
requires less current to execute than reading only used periodically can be disabled for the
RAM or branching operations, so current can remainder of the application. The PMD bits are
be reduced. The overall loop count can be most effective at high clock speeds and when
adjusted to account for the extra instructions for operating at full speed allowing the average
the NOPs. power consumption to be significantly reduced.
Example:
Replace:
while(!_T1IF);
with Idle mode:
IEC0bits.T1IE = 1;
Idle();
and replace:
while(!_T1IF){
i++;
}
with extra NOP instructions:
while(!_T1IF){
i++;
Nop();
Nop();
Nop();
Nop();
Nop();

© 2009 Microchip Technology Inc. DS01146B-Page 2-9


PIC® Microcontroller Low Power Tips ‘n Tricks

Static Power Reduction Tips n’ Tricks TIP #17 Extended WDT and Deep
The following tips and tricks will help reduce Sleep WDT
the power consumption of a device while it is A commonly used source to wake-up from
asleep. These tips allow an application to stay Sleep or Deep Sleep is the Watchdog Timer
asleep longer and to consume less current (WDT) or Deep Sleep Watchdog Timer
while sleeping. (DSWDT). The longer the PIC MCU stays
TIP #16 Deep Sleep Mode in Sleep or Deep Sleep, the less power
consumed. Therefore, it is appropriate to use
In Deep Sleep mode, the CPU and all as long a timeout period for the WDT as the
peripherals except RTCC, DSWDT and application will allow.
LCD (on LCD devices) are not powered.
Additionally, Deep Sleep powers down the The WDT runs in all modes except for Deep
Flash, SRAM, and voltage supervisory circuits. Sleep. In Deep Sleep, the DSWDT is used
This allows Deep Sleep mode to have lower instead. The DSWDT uses less current and
power consumption than any other operating has a longer timeout period than the WDT. The
mode. Typical Deep Sleep current is less than timeout period for the WDT varies by device,
50 nA on most devices. Four bytes of data are but typically can vary from a few milliseconds to
retained in the DSGPRx registers that can be up to 2 minutes. The DSWDT time-out period
used to save some critical data required for the can be programmed from 2.1ms to 25.7days
application. While in Deep Sleep mode, the TIP #18 Low Power Timer1 Oscillator
states of I/O pins and 32 kHz crystal oscillator
(Timer1/SOSC) are maintained so that Deep and RTCC
Sleep mode does not interrupt the operation of nanoWatt XLP microcontrollers all have a
the application. The RTCC interrupt, Ultra Low robust Timer1 oscillator (SOSC on PIC24)
Power Wake-up, DSWDT time-out, External which draws less than 800 nA. nanoWatt
Interrupt 0 (INT0), MCLR or POR can wake-up technology devices offer a low power Timer1
the device from Deep Sleep. Upon wake-up the oscillator which draws 2-3 uA. Some devices
device resumes operation at the reset vector. offer a selectable oscillator which can be used
in either a low-power or high-drive strength
Deep Sleep allows for the lowest possible
mode to suit both low power or higher noise
static power in a device. The trade-off is that
applications. The Timer1 counter and oscillator
the firmware must re-initialize after wake-
can be used to generate interrupts for periodic
up. Therefore, Deep Sleep is best used in
wakes from Sleep and other power managed
applications that require long battery life and
modes, and can be used as the basis for a real-
have long sleep times. Refer to the device
time clock. Timer1/SOSC wake-up options vary
datasheets and Family Reference Manuals for
by device. Many nanoWatt XLP devices have a
more information on Deep Sleep and how it is
built-in hardware Real-Time Clock and Calendar
used.
(RTCC), which can be configured for wake-up
periods from 1 second to many years.
Some nanoWatt devices and all nanoWatt
XLP devices can also use the Timer1/SOSC
oscillator as the system clock source in place
of the main oscillator on the OSC1/OSC2 pins.
By reducing execution speed, total current
consumption can be reduced.

Page 2-10-DS01146B © 2009 Microchip Technology Inc.


PIC® Microcontroller Low Power Tips ‘n Tricks

TIP #19 Low Power Timer1 Oscillator TIP #20 Use LVD to Detect Low
Layout Battery
Applications requiring very low power Timer1/ The Low Voltage Detect (LVD) interrupt present
SOSC oscillators on nanoWatt and nanoWatt in many PIC MCUs is critical in battery based
XLP devices must take PCB layout into systems. It is necessary for two reasons.
consideration. The very low power Timer1/ First, many devices cannot run full speed at
SOSC oscillators on nanoWatt and nanoWatt the minimum operating voltage. In this case,
XLP devices consume very little current, and the LVD interrupt indicates when the battery
this sometimes makes the oscillator circuit voltage is dropping so that the CPU clock can
sensitive to neighboring circuits. The oscillator be slowed down to an appropriate speed,
circuit (crystal and capacitors) should be located preventing code misexecution. Second, it allows
as close as possible to the microcontroller. the MCU to detect when the battery is nearing
No circuits should be passing through the the end of its life, so that a low battery indication
oscillator circuit boundaries. If it is unavoidable can be provided and a lower power state can
to have high-speed circuits near the oscillator be entered to maximize battery lifetime. The
circuit, a guard ring should be placed around the LVD allows these functions to be implemented
oscillator circuit and microcontroller pins similar without requiring the use of extra analog
to the figure below. Placing a ground plane channels to measure the battery level.
under the oscillator components also helps to TIP #21 Use Peripheral FIFO and
prevent interaction with high speed circuits.
DMA
Figure 19-1: Guard Ring Around Oscillator Some devices have peripherals with DMA or
Circuit and MCU Pins FIFO buffers. These features are not just useful
to improve performance; they can also be used
VSS to reduce power. Peripherals with just one
OSC1 buffer register require the CPU to stay operating
in order to read from the buffer so it doesn’t
OSC2
overflow. However, with a FIFO or DMA, the
CPU can go to sleep or idle until the FIFO fills or
RB7
DMA transfer completes. This allows the device
to consume a lot less average current over the
RB6 life of the application.

RB5

© 2009 Microchip Technology Inc. DS01146B-Page 2-11


PIC® Microcontroller Low Power Tips ‘n Tricks

TIP #22 Ultra Low-Power Wake-Up


Peripheral
Newer devices have a modification to PORTA
that creates an Ultra Low-Power Wake-Up
(ULPWU) peripheral. A small current sink and
a comparator have been added that allows
an external capacitor to be used as a wake-
up timer. This feature provides a low-power
periodic wake-up source which is dependent on
the discharge time of the external RC circuit.
Figure 22-1: Ultra Low-Power Wake-Up
Peripheral

Pin Wake-on-Change
C I Interrupt
VREF

If the accuracy of the Watchdog Timer is not


required, this peripheral can save a lot of
current.
Visit the low power design center at:
www.microchip.com/lowpower for
additional design resources.

Page 2-12-DS01146B © 2009 Microchip Technology Inc.

You might also like