IESO

You might also like

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 2

What exactly do IESO(Internal External Switchover) in PIC microcontrollers?

What i can do with IESO ?


IESO, as you say, refers to Internal/External Oscillator Switchover.
It's available (I believe) on all PIC microcontrollers with nanoWatt XLP. This i
s a significant clue: it has something to do with saving power.
You see, on portable embedded devices, the most precious resource is almost alwa
ys battery. Not draining the battery too much is something that everyone, from t
he chip designers, to the hardware designers, to the programmer, has to worry ab
out. As a result, the PIC designers gave the programmer lots of ways to avoid us
ing power if it's not needed.
Most of the power dissipation is in the execution core itself, not the periphera
ls (I/O pins, USARTs and what have you). So one key thing that a designer needs
to be able to do is turn off the execution core (so-called "sleep mode") if you
don't need to execute code at that particular moment. There are various ways to
wake up the execution core, including POR (power-on reset), the power-up timer (
PWRT; this is handy if you just need to go to sleep for a fixed amount of time,
like 1ms) or by I/O (e.g. when data arrives on a USART).
However, there is a problem here. The execution core's clock is a quartz crystal
(which is external to the microcontroller) connected to a negative feedback cir
cuit. This doesn't require very much power to run, so is ideal for low-power dev
ices, but it does take some time to warm up. This means that there is a delay be
tween the time when the core is woken up and it can run on that clock.
This is where IESO comes in. The PIC has two internal oscillators, a low-frequen
cy one and a high-frequency one (called LFINTOSC and HFINTOSC respectively) whic
h are used for various internal functions. Enabling IESO lets the microcontrolle
r run off one of these internal clocks (you can choose which one until the exter
nal oscillator has stabilised. The hardware looks for 1024 clock cycles from the
external crystal before switching over to it.
The catch is that these internal clocks are much slower than the external clock.
Like, a LOT slower. The external crystal might be running at 20MHz, but LFINTOS
C runs at 31kHz at the most. However, this still lets you get useful work done w
hile you're waiting for the main clock to ramp up; if it's a sampling applicatio
n, it enables you to start an acquisition cycle from the DAC, or if it's communi
cation, it lets you grab the byte which arrived on the USART so it can process a
nother one.
You can pick which internal oscillator will be used with ICRF and INTSRC. Take a
look at the data sheet for your microcontroller for the full gory details. In p
articular, look up "two-speed start-up".
So what's it for? Power managament, basically. It's not really going to be any u
se to you except under two specific circumstances:
1. You're planning for the device to spend a lot of time in sleep mode to save o
n power.
2. You need to start doing useful work as soon as possible after it's woken up f
rom sleep mode.
The two examples I gave, where the device will spend a lot of time waiting for t
he next byte to arrive on the USART, or waiting between acquiring samples from t

he DAC, are almost perfect use cases for doing this. But it's probably worth not
ing that it's not necessarily useful in every wake-up scenario.
If you're implementing a pocket calculator, for example, then you're really work
ing at the speed of the user's fingers. It takes so long for the user to press a
button that you can probably afford to wait a millisecond for the clock to stab
ilise. The same goes for a soft power switch.
But you can't afford to wait a millisecond if you're sampling or playing audio a
t 48kHz, or communicating at 28.8kbaud.
I hope that answers your question.

You might also like