Make Electronics

(nextflipdebug2) #1

Experiment 34: Hardware Meets Software


294 Chapter 5


There are three answers:


  1. MCUs cannot do everything. They need other components to help them
    interact with the world, such as transistors, relays, sensors, and amplifiers.
    You need to know how those things work, so that you can make intel-
    ligent use of them.

  2. MCUs can introduce their own kinds of problems and errors, associated
    with using software in addition to hardware. I’ll have more to say about
    this later.

  3. MCUs have limits and restrictions, most obviously their requirement for a
    5-volt regulated power supply, and their inability to source or sink much
    current from each pin. They also demand that you learn a programming
    language (which differs from one brand of MCU to the next). And to get
    the program into the chip, you have to be able to plug it into a computer
    and do a download, which is not always convenient.
    In this experiment, you’ll learn how to write a program for a small and simple
    MCU, and you’ll transfer the program into it and see how it works.


BAckground


Origins of  programmable    chips
In factories and laboratories, many procedures are repetitive. A flow sensor may
have to control a heating element. A motion sensor may have to adjust the
speed of a motor. Microcontrollers are perfect for this kind of routine task.
A company named General Instrument introduced an early line of MCUs in 1976,
and called them PICs, meaning Programmable Intelligent Computer—or Pro-
grammable Interface Controller, depending which source you believe. General
Instrument sold the brand to another company named Microchip Technology,
which owns it today.
“PIC” is trademarked, but is sometimes used as if it’s a generic term, like Scotch
tape. In this book, I’ve chosen a range of controllers based on the PIC architec-
ture. They are licensed by a British company named Revolution Education Ltd.,
which calls its range of chips the PICAXE, for no apparent logical reason other
than that it sounds cool.
I like these microcontrollers because they were developed originally as an edu-
cational tool and because they are very easy to use. They’re cheap, and some of
them are quite powerful. Despite their odd name, I think they’re the best way to
get acquainted with the core concepts of MCUs.
After you play with the PICAXE, if you want to go farther into MCUs, I suggest
the BASIC Stamp (which uses a very similar language, but with additional pow-
erful commands) and the very popular Arduino (which is a more recent design,
packed with powerful features, but requires you to learn a variant of C language
to program it). I’ll say more about these chips later.
If you search for “picaxe” on Wikipedia, you’ll find an excellent introduction to
all the various features. In fact, I think it’s a clearer overview than you’ll get from
the PICAXE website.
Free download pdf