Our second program ( keypad2.bas)
incorporates all the changes we just
discussed. Open it in the Programming
Editor and change the theoretical
mid-point values in each of the case
conditions to the values you calculated
from the results of running keypad1.bas.
Also note that the sertxd statement
has changed; instead of sending the
individual digits of the ADC value,
we’re now transmitting the appropriate
ASCII value for each character to the
terminal window. Download the
program to your breadboard circuit
and test all the keypresses. You
should see the correct character
appear in the terminal window in
response to each keypress. If not, a
little trouble-shooting is in order.
WHAT’S AN EVIL
GENIUS TO DO?
the convenient layout for the four
arrow keys and the fact that the
“Enter” key is in the lower right-hand
corner where it should be.
Next, the modified keypad was
used to develop a programmable,
multi-function peripheral device (MPD)
that can be easily connected to any
breadboard circuit (see Figure 9).
Because the MPD is fully programmable,
it can be used to implement a variety
of helpful utility and troubleshooting
applications for use with any PICAXE
project. The following are just a few
of the many possibilities:
• Stand-alone I/O terminal with sound
• Digital frequency generator
• Frequency measurement of project
signals
• Timing of project routines and
waveforms
That’s as far as we’re going to take
our ADC keypad project this month.
I’m sure it’s no surprise that the project
we tackled in the Evil Genius book was
to design a serialized version that
simplified the interface with a master
processor by freeing the master from
the chore of repetitively monitoring
an ADC input. Next, we performed a
little “surgery” on our keypad. We
disassembled it and rearranged its
innards, so that the connector was
moved to the top of the keypad and
its keys were shuffled into a more
convenient pattern. The results of our
little operation are shown in Figure 8.
COMING ATTRACTIONS
In addition to the publication of
PICAXE® Microcontroller Projects for
the Evil Genius, there’s another major
event that’s about to occur in the
PICAXE world. Revolution Education
has announced its newest processor
— the PICAXE-18M2 — and it’s
scheduled to be available by the time
you’re reading this column. The
18M2 is a revolutionary product with
many impressive hardware and
software enhancements. I don’t have
space this month to get into the
details, but take a look at Figure 10. I
■ FIGURE 10. Comparison
of 18M2 vs. 18M selected
features.
18M2 18M
General Purpose Vars (bytes) 28 14
Storage Variables (bytes) 256 48
EEPROM Storage (bytes) 256 256-prog
Max Operating Speed (MHz) 32 8
Min Operating Voltage (V) 1.8 3.0
PICAXE PRIMER
think you’ll be impressed.
The 18M2 also includes several
software enhancements; I’ll just mention
two of them to whet your appetite.
There’s a new built-in time variable
that keeps track of elapsed time in the
background while your program is
carrying out other tasks. This means
that a project will be able to include
a real-time clock feature without
necessitating additional hardware or
complicated software interrupt routines.
Also, the 18M2 will be able to run up to
four different program tasks in parallel
at the same time by rapidly switching
among the various program “threads.”
This new capability isn’t multitasking
in the strict sense, because program
instructions are still being executed
one at a time. However, the
automatic switching among program
threads will occur so rapidly that it
will create the illusion of multitasking.
I have saved the most impressive
specification of the new 18M2
processor until last; it’s slated to retail
for about the same price as the older
18M processor. To be able to purchase
that amount of processing power for
less than $4 is truly amazing. I’m eager
to get my hands on one, and as soon
as I do (which will almost certainly
be in time for the next Primer
column), I’ll get to work on reporting
what I learn about this impressive
new chip. See you then ... NV
■ FIGURE 9. The Evil Genius MPD.
October 2010 71