add pntr, #2
wrword ch6us, pntr
wrlong YES, flagpntr
This is pretty straightforward. We set up a pointer to
the hub array (of words) that holds the channel values and
then transfer the readings from the cog. At the end, we
write YES (true) to the flag that indicates PPM status to
alert the application that the stream is present and the
position values are fresh.
Figure 7 shows the output from a test program that
reads and displays the PPM stream
status and channel values.
pub main | c
term.start(RX, TX, %0000, 115_200)
rgled.initx(R_LED, G_LED, 50, OFF)
adc.init(CS, CLK, DIO)
c := term.rx
“““““““1” : showdigins
“““““““2” : demoled
TESTING 1, 2, 3 ...
I often see posts in the Propeller
support forum that go something like
this: “I built my hardware, I wrote my
software — it doesn’t work. What do
Test. Test. Test. The good news is
that the Propeller architecture helps
us. Earlier this year, my friend and I
created and released a Propeller-based WAV audio player (the EFX-TEK
AP- 16+) that is designed for museums,
theme parks, and attraction-based
industries like Halloween. It’s a beast.
Because of the variability of the user
base, it has lots of flexibility in its
design which means lots of I/O and a
fairly tricky PCB.
While John (who also worked for
Parallax) was creating the PCB for the
first prototype, I wrote a test program
to check each section of the board —
this was well before a single line of
application code was written. Of
course, that’s a bit of a fib, isn’t it?
You see, a large portion of the code
used in testing moved right into the
final application. In fact, as I refined
the test program I was refining
portions of the application code.
The ability to program the
Propeller through a serial port means
that we can create a self-hosted test
program that uses a simple terminal.
As an example for you to play with, I
created a test program for this
month’s project board. When that
program starts, it presents a menu
using PST (see Figure 8) that lets us
access/test each section of the
board. Here’s the main program
The Newest Products for
Your Newest Designs™
Industry’s only full-featured online catalog
•Browse •Search •Check Stock •Buy
Try It Now at mouser.com
Over 1.6 MILLION products
WARNING: Designing with Hot, New Products
May Cause A Time-to-Market Advantage.
mouser.com (800) 346-6873
Mouser and Mouser Electronics are registered trademarks of Mouser Electronics, Inc. Other products, logos, and company names mentioned herein, may be trademarks of their respective o wners.
September 2010 19