Nuts & Volts
Nuts & Volts
Nuts & Volts
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
GETTING STARTED WITH PICs<br />
BASIC ATOM<br />
One of my favorite Microchip PIC<br />
options is the Basic Atom. I’m sure<br />
you’ve seen the Atom modules in<br />
<strong>Nuts</strong> & <strong>Volts</strong> which have the same<br />
footprint and look of the BASIC Stamp<br />
modules, but what many people don’t<br />
realize is at the heart of an Atom module<br />
is actually a Microchip PIC16F876A<br />
or PIC16F877A chip with a selfprogramming<br />
bootloader inside. It’s a<br />
PIC (Figure 2) that you can purchase<br />
separately from the module and use in<br />
your PIC16F877 or 876 circuit.<br />
The story of the Basic Atom is<br />
interesting. It was created by a couple<br />
of guys in Michigan, only a few miles<br />
away from where I live. They started<br />
out by creating a PICBasic Pro compiler<br />
competitor called the MBasic<br />
compiler. It sold well, but had a lot of<br />
early bugs. Because it was only two<br />
guys, handling all the tech support<br />
became a problem. They realized that<br />
a lot of the tech support involved the<br />
differences with the various PICs. If<br />
they could focus on just a few key<br />
PICs, they felt they could make a solid<br />
compiler with the time they had.<br />
The BASIC Stamp, being so popular,<br />
became the footprint they tried to emulate,<br />
but instead of using the fetch and<br />
function BASIC Stamp method, they<br />
took their MBasic compiler and combined<br />
it with a custom bootloader program<br />
for the PIC16F876 and PIC16F877.<br />
These PIC chips have the unique ability<br />
to program their own internal memory<br />
with a small program hidden in their<br />
program memory called a bootloader.<br />
It’s kind-of like having an operating<br />
system on your PC prior to loading a<br />
program you really want to run.<br />
The features of the MBasic compiler<br />
were carried over to the Atom, so<br />
this gives the Atom access to all the<br />
PIC features, such as timers, A/D,<br />
interrupts, etc. The Atom sold well<br />
right from the start since it offered<br />
higher speed and more memory. To<br />
me, though, the big feature was the<br />
fact that I could program the Atom<br />
PIC chips and plug them into any PIC<br />
16F876 or 877 development board.<br />
If I designed my own development<br />
■ FIGURE 3. The in-circut debugger<br />
program screen shot.<br />
board with a serial communication<br />
circuit, similar to the RS232 circuit I<br />
used in the March issue, then I could<br />
program the Atom PIC 16F876 or 877<br />
right in-circuit without having to<br />
remove the PIC over and over again.<br />
IN-CIRCUIT<br />
DEBUGGER (ICD)<br />
This is what locked me into the<br />
Atom. The MBasic compiler had an<br />
in-circuit debugger program (Figure 3)<br />
built in that allowed you to run your<br />
program in slow motion command by<br />
command. This made it easy to catch<br />
errors because you could see the<br />
changes in the RAM (variables), special<br />
function registers (timers, Portb,<br />
etc.), and even run sections of program<br />
in real time, but stop at a breakpoint.<br />
It was like having a Basic language<br />
driven emulator and it was included<br />
for free and in the Atom software.<br />
So, why would I be so excited about<br />
all this and why am I telling you this?<br />
It’s because they give away the Atom<br />
compiler software for free. The only<br />
catch is you have to buy the Atom PIC<br />
chips from them or an authorized<br />
reseller — like my site. The Atom chips<br />
cost $20 each, so if you are going to<br />
build a 100-piece design, then using the<br />
PICBasic Pro compiler will quickly pay<br />
for itself over the Atom, but most readers<br />
are just experimenting or building a<br />
few prototypes. For $20, you get a fullfeatured<br />
compiler with in-circuit debugger<br />
and features PICBasic Pro doesn’t<br />
have, such as floating point math and<br />
much simpler access to timers and<br />
other special function registers.<br />
Here is the best part of all. They<br />
kept most of the syntax of the Basic<br />
commands compatible with the BASIC<br />
Stamp and PICBasic Pro, so moving a<br />
program from the Stamp to PICBasic to<br />
the Atom is quite easy. I often create<br />
with the Atom using the ICD to prove<br />
out the idea and then move to PICBasic<br />
Pro for higher volume applications.<br />
The Atom has been used by so<br />
many people, it’s been proven to be a<br />
very solid compiler. I recently released<br />
my second book — this time on the<br />
Atom — titled Programming the Basic<br />
Atom Microcontroller. You should be<br />
able to find it at the <strong>Nuts</strong> & <strong>Volts</strong> bookstore,<br />
my website, and a few other<br />
resellers. My point to all this is that<br />
you still don’t have to spend more than<br />
$50 to program PICs beyond the 31<br />
command line limit, just like my<br />
January article pointed out. I’ve even<br />
put some of my Atom-based modules<br />
on my website that are designed for<br />
the beginner that wants a complete<br />
development module with the<br />
programming interface built in. I even<br />
have my BasicBoard with LCD, LEDs,<br />
switches, speaker, and potentiometer<br />
April 2006 75