everything the PC does with a useful
purpose to humans runs through the
I/O. What if you could shrink all those
components: microprocessor, ROM,
RAM, and I/O, into a single integrated
circuit? It can be done and it’s called a
microcontroller (Figure 1).
There are various companies that
make these small microcontrollers
and each has a unique personality.
Microchip PICs are, in my opinion, the
best in the business but don’t just
take my word for it. Microchip has
become the number 1 seller of
eight-bit microcontrollers in the
world. Microchip did this by offering a
whole family of PICs with various I/O
features that industry wanted.
The best part is you can use
Microchip PICs the same way industry
does without laying out a load of
money. All you need is software for
the PC to write the binary code and a
means to burn that code into the PIC.
A popular version of the PICs is the
16F876A shown in Figure 1. These can
be purchased from various sources for
properly, you can make the PIC’s I/O
turn on and off to control electrical circuitry connected to the PIC’s I/O pins.
That circuitry could be a simple relay
that turns a light on during the night
and off during the day. It could be more
complex and control the motors of a
robot while reading an obstacle sensor
to make the robot drive around a maze.
All you need to do is write this series of
binary code, which is the software.
HOW DOES A PIC WORK?
A microcontroller or PIC requires a
series of coded electrical signals in its
ROM to tell it what to do. This is known
as software or code. When a microcontroller is said to be programmed or have
code burned into it, it is getting these
coded electrical signals stored into its
ROM. To run the program, the microcontroller then needs a way to select each
command from ROM, one at a time,
which is known as running a program.
The microcontroller has a clock
oscillator, controlled by an external
crystal or resonator, which sends a continuous pulse to the microcontroller’s
central circuitry when it is powered up.
It’s like the heart of the microcontroller
sending clock signals that control all
functions, similar to the way our heart
pulses our blood through our body
making all our functions work. On each
pulse of the clock, the PIC retrieves a
new command code from ROM to execute on the PIC I/O. These coded electrical signals are in the format of 1s (five
volts) and 0s (ground) or binary code.
By arranging these binary codes
Arranging 1s and 0s properly was
made easier by the development of
assembly language. Microchip developed an assembly language for the PIC
that is a series of crude acronyms, each
with a specific task. The acronyms are
converted into the 1s and 0s by means
of a PC software program called an
assembler. Even though this is easier
than coding directly in 1s and 0s, it’s
still very cryptic. To resolve that
problem, several companies developed
higher-level languages that use
easy-to-understand words. Each of the
words represent a function and are
converted into assembly language.
When these higher-level programs
are converted into assembly language,
they are said to be “compiled.” There
are several different compilers out
there with names such as “C” language
or Java language and my favorite, Basic.
The PicBasic Pro compiler (Figure
2) is very easy to use and a great
language for someone just getting
started. It uses the same format as the
popular BASIC Stamp modules but
produces a binary file so you can
program blank, lower cost PICs.
The PicBasic Pro compiler has
advanced over the years to become
just as powerful as any other
“professional” compiler. You can
download a free sample version
of the PicBasic Pro compiler,
which is more powerful than
you might think.
Okay, we’ve now
covered what a
Microchip PIC is.
We know what
it takes to
how do we get
the code (1s
and 0s) into the
PIC? We do that
with a PIC programmer.
A PIC programmer is a custom
designed module that generates the
electrical signals the PIC’s ROM memory requires. The programmer stores
these signals, in proper order, in the
Microchip PIC. The PIC programmer
requires software for the PC that will
take the compiled/assembled file of
1s and 0s and send it out the PC’s
serial port to the PIC programmer.
Figure 3 shows my version of an
extremely low cost serial port powered PIC programmer based on the
JDM Programmer hardware design at
You don’t have to rely on my programmer, either. There are other JDM
style programmers available from various sources. Do a Google search and
you’ll find several. This programmer is
driven with the “free” software developed by Bonny Gijzen that you can
download at www.ic-prog.com
Because this programmer is serial port powered, it doesn’t work with
most laptop computers because the
serial port voltage levels are lower on
many laptops. It also won’t work with
USB to RS232 adapters. Despite these
limitations and the free software, you would be amazed
at how reliable this JDM
style programmer is.
Bonny Gijzen has kept
the software updated to
work with the latest PICs. I
have used it for over a year and
never once had a problem
programming a PIC from my
desktop computer. This is a great
PIC programmer design to start with.
In fact, I’m turning my design into a kit
⇐ form so the hobbyist FIGURE 3. can solder it together
Serial Port as a first project and
Programmers. then use it for all future
January 2006 75