Just a note for you Arduino lurkers (I know you're out
there, dying to try the Propeller but comfortable with the
code you've already written): A Propeller forum regular
named Perry has created a library of methods — similar to
what I've done above — that allow you to do most of the
things you do with the Arduino now on the Propeller. To
get the latest update, do a search for 'Arduino' on the
Propeller Object Exchange.
Please keep in mind that the Propeller processor and
the Atmel processor used in Arduinos are very different
beasts, so it's not going to be perfect. Still, Perry's shown
that it's a pretty simple task to port many programs to the
Propeller with this library. Once you go multi-processor,
you may never go back!
There are two additional methods in my QuickStart
template. The first allows us to set all of the LEDs at once:
outa[LED7..LED0] := ledbits
dira[LED7..LED0] := %1111_1111
Easy peasy! Move the pattern in ledbits to the pins
using the outa register, then make those pins outputs by
setting the bits in the direction register to 1s.
The next method — used to read the button pads on
the QuickStart — is a little more involved. The buttons are
not actual mechanical buttons, they are simply pads with a
break; one side connects to the Propeller pin, another
connects to ground:
outa[PAD7..PAD0] := %1111_1111
dira[PAD7..PAD0] := %1111_1111
dira[PAD7..PAD0] := %0000_0000
waitcnt(cnt + (clkfreq / 100))
return !ina[PAD7..PAD0] & $FF
The first two lines of this method set all of the pad
pins to outputs and high. This charges the parasitic
capacitance of the pins. The pins are returned to input
mode (to allow discharge) and a 10 ms delay is inserted.
This gives the pin time to discharge through a fingertip,
but not enough time to do it on its own. As 'touched' pads
will read as 0, the bits are inverted (so, 1 = touched),
trimmed, and then returned to the caller.
This code is a translation of the PASM code for this
process available on the Parallax semiconductor website.
Though it worked right off, I wondered about the timing.
The great thing about the Propeller — and something I've
demonstrated many times — is that it can time itself. I was
curious about the 10 ms selection, so I wrote a program
that would charge the pads and time the duration for self-discharge. The result was 30 to 80 milliseconds, so it
seems that 10 ms is a good choice — enough time to
discharge the pin through a fingertip; not enough for the
pin to fully discharge on its own.
A word of caution about the button pads: The I/O
pins used are protected with 100K resistors but if you find
yourself filled with static electricity (zapping yourself on
every doorknob you touch), you'd probably want to
discharge yourself before touching your QuickStart button
In addition to the template, I've created a few demo
programs for you to play with. If you have a QuickStart
that is waiting for some action, give these simple programs
a try. Once you understand them, change them, build on
them, and then do your own thing.
Another good point about the Propeller Tool is that
the Help menu includes all the relevant Propeller
documentation, including the text of the Propeller
Education Kit. Now, this is a big kit with lots of parts, and
the text does a good job of explaining Propeller
programming fundamentals. For some real fun, you may
want to augment your QuickStart with a Human Interface
Device (HID) board — this will let you explore advanced
I/O including mouse, keyboard, composite video, VGA,
audio, microSD card access, and IR in and out. If you're
into networking, Parallax recently created a Wiznet add-on
for the QuickStart.
CREATING A CUSTOM ADD-ON
If you're like me, there will come a time when you
want to create your own QuickStart add-on. For many
one-offs, there is a QuickStart prototyping board that
facilitates adding custom circuitry to the QuickStart.
Figure 6 shows the pinout of the QuickStart
expansion header. Most pins are self-evident, but
there's a few that are worth discussion.
JON “JONNYMAC” MCPHALEN
Propeller chips and programming tools
Solder paste and SMD tools
May 2013 15