bytemove(@GameCode, @keybuf, 4)
repeat idx from 0 to 3
gtime := get_time
if (gtime > 0)
GameTime := gtime
The check_update() method gets called at the
very beginning of the program, so the first thing that
happens is a delay to allow the keyboard to be debounced.
It’s a long way from the BASIC Stamp 1 to
the Propeller P1, but it doesn’t require a lot of
scrutinizing to find the genetic similarities — they
were born of the same creator (Chip Gracey). It
makes sense, then, that a BASIC language in
some form is available for the Propeller. PropBASIC is a
derivative of SX/B, a compiler created by Terry “Bean”
Hitt. I worked with him on SX/B while I was at Parallax,
and that compiler (which was integrated into the SX-Key
IDE [integrated development environment]) helped a lot of
people migrate their BASIC Stamp projects to the SX. In
the early days of EFX-TEK, all of our products were based
on the SX and programmed in SX/B. It really was a
wonderful tool for those of us who don’t enjoy
programming in assembly language.
If the keyboard does not return our special code for [*] +
[#], we exit. The scroll_str() method is used to run a prompt
message through the 14-segment module. As luck would
have it, the last four letters of the message are “CODE,” and
this remains in the display until a new four-digit code is
entered. Likewise, for the game time, “TIME” will be
displayed for that entry. The time value is accepted in a
repeat loop so that we can put limits on the time entry; in
this case, it must be greater than zero. We could set an
upper limit if we like, as well. If a limit is violated, the loop
runs again which re-displays the prompt and waits for input.
So, there you have it: a simple, configurable,
countdown timer with keyboard entry. I use this as a
starting point for many escape room props, but this code
lends itself to a wide variety of timed control applications.
Figure 4 shows the updated project pieces with the code
running. The final step is to wire up a PAB overlay board
(#32999) so that the connections stay in place. I can swap
out the Activity board if needed. Oh, and I guess I had
better call Rick and ask him if he’ll help me machine an
enclosure for everything.
PropBASIC, though, struggled in the early days because
it’s a compiler in need of an IDE, and there was never an
ideal solution — until now. Brett Weir has been doing
tremendous work on PropellerIDE, and his latest version
enables seamless use of PropBASIC. This means that we can
do BASIC and Spin programming side-by-side in the same
editor! Nice! Figure 5 is a screen capture of the latest
PropellerIDE with a PropBASIC program loaded. Note how
the project explorer panel details everything, with external
files shown as collapsible lists. There are icons for
subroutines, functions, variables, and even I/O pins.
If, like me, you have stayed away from PropBASIC
because it lacked a proper IDE, those days are over.
New Life for PropBASIC
In BASIC or Spin (or even C or Forth), keep spinning
and winning with the Propeller! NV
Like many, I taught myself to program in
BASIC using the Timex-Sinclair 1000 computer.
When the BASIC Stamp arrived in late 1993, I
was thrilled because it meant I could apply my
BASIC programming skills to the embedded
projects I enjoy building. I finally bought my first
BASIC Stamp 1 in early 1994, and I have been
programming BS1 modules nearly every day
since. Yes, I still use them.
September 2016 61
■ FIGURE 4.
■ FIGURE 5.