Since the clock is so important, PIC microcontrollers offer a broad range of options to choose from for your own applications. You can have clocks that run
rapidly when a lot has to happen in a short span of
time, or ones that consume negligible power for
battery-operated rigs. Maybe synchronizing the PIC
to a stable real time clock is important to you. In fact,
there are eight or more clock options for the typical
PIC.
However, if you grab the datasheet and try to
sort out all the possibilities, you'll quickly come to rue
that old phrase, "Can't see the forest for the trees."
Datasheets for PICs run in the hundreds of pages and
aren't necessarily organized for best learning. And, of
course, the occasional error works its way in, making
it even harder for the newcomer to get up to speed.
As someone who has spent his entire adult life in
teaching, I've always intuitively valued the importance
of a well organized presentation. You begin with the
"forest" and only approach the "trees" afterwards.
That's what we'll do here — getting the big picture in
mind first and then tackling the details when they're
finally needed.
So, if you've been dismayed in the past at how
complicated the clock options for PICs seem to be,
tag along now and see how the right approach can
make all the difference. To turn this into an active
learning experience, we’ll conclude with some actual
experiments you can conduct on the breadboard. By
the end of our session together, you should be all set
to start using PIC clocks with confidence.
Primary Clocks
To keep things concrete, I'll focus on the
PIC16F88 which is one of the most popular of all
microcontrollers among DIYers. However, other PICs
will sport many of the same options — even the
smaller eight-pin chips.
All microcontrollers require a clock or oscillator to guide
a program through its paces. It's the duty of such a
module to indicate when an instruction should be
fetched from program memory, decoded, and acted
upon. Actually, even the simplest instruction is made up
of a number of operations that must be sequenced in
just the right order and at just the right moment. The
clock, then, is like the conductor of an orchestra,
coordinating all of the parts that make up the whole.
All About
Clocks for PICs
By Thomas Henry
studs.kreitzer@gmail.com
38 January 2014
Post comments on this article and find any associated files and/or downloads at
www.nutsvolts.com/index.php?/magazine/article/january2014_Henry.