PICAXE PRIMER
SHARPENING YOUR TOOLS OF CREATIVITY
■ BY RON HACKETT
GETTING STARTED WITH THE
PICAXE-28X1 MICROCONTROLLER
IN ESSENCE, THE PICAXE-28X1 IS LIKE A 28X ON STEROIDS. It’s pin-for-pin
compatible with the 28X and all the 28X commands will function correctly on
a 28X1. In other words, if you have an existing 28X circuit, it will function exactly
the same with a 28X1 installed. This is a good thing, because Revolution
Education considers the 28X to be obsolete and has discontinued it.
Amazingly, the new 28X1 is about the same price as the old 28X.
The PICAXE-28X1 has so many
improvements and powerful new
features that it’s hard to know where
to begin. In order to avoid the risk of
information overload, I have decided
on a two-phase approach. In this
installment of the Primer, I’ll present
a brief overview of most of the new
features and then go into more detail
on a couple of them that we will be
using right away. In future Primer
installments, we’ll explore each new
feature in depth as we have a need
to use it in a project.
of all the current PICAXE processors;
a quick glance will give you some
idea of the scope of the 28X1’s
improvements in this area. Most of
the information in Figure 1 is self-explanatory but a couple of points
are worth noting.
First of all, the general-purpose
byte variables (b0 to b13 in all the
previous PICAXE chips) have been
doubled to b0 to b27 in the 28X1. If
you have ever run out of variables in
a program, you will appreciate how
significant this improvement is. Also,
the 28X1 includes an entirely new
128-byte storage area (the scratchpad) that can be used for additional
storage; it’s especially useful for
tables and arrays as we will see in a
future installment of the Primer.
Finally, although it’s not included
in Figure 1, it’s worth mentioning that
the maximum system speed has been
increased from 8 MHz in the earlier
processors to 20 MHz in the 28X1.
System speed options have also
become much more flexible —
we’ll get to that in detail later in
this installment when we take a
look at the new resonator features
of the 28X1.
SOFTWARE
IMPROVEMENTS
HARDWARE
IMPROVEMENTS
Let’s begin by taking a look at
the memory and storage capacity
of the 28X1. Figure 1 presents a
comparison of the relevant features
08M/14M/20M 18X 28X1/40X1
BASIC Program Memory 80 Lines 600 Lines 1000 Lines
General Purpose Variables 14 14 28
Storage Variables (peek/poke) 48 96 95
Scratchpad Variables (get/put) - - 128
Special Function Variables 3/4/4 4 7
EEPROM Data Storage 256 - program 256 256
Figure 2 presents the pin-out of
the 28X1; in it, some of the major new
software functions are highlighted in
a larger bold font. We will consider
the pins in numerical order, so the
first new feature that jumps out is
“ULPWU” (pin 2), which is an
acronym for the new “Ultra Low-Power Wake-Up” feature. We will
explore the ULPWU in some detail
in a future installment of the Primer
when we begin working on a 28X1
battery-powered data-logging system,
but for now all we need to know
about it is that ULPWU provides a
means for greatly reducing power
consumption.
Next, we see the “timer clock”
function on pin 11. This feature
■ FIGURE 1. PICAXE processor
memory comparisons.
16
August 2008