point, another note of caution is in
order — music files usually create very
long lines in your program. Don’t try to
break up these long lines by inserting a
“return” character — it will confuse the
Programming Editor. If you want to
break up a line, insert a “space”
character instead — that way, the editor
will interpret the music data correctly.
Figure 1 presents the final program
file formatted with a couple of extra
spaces in the long line. I also made one
minor change to RevEd’s file. The first
parameter of the tune command
determines whether the LEDs will blink
as they did with Rudolph (again, see
the documentation). I changed the
parameter’s value from zero to three
so the LEDs will blink.
When you have completed editing your program, download it to the
same 08M circuit we used last time (in
the December ‘07 issue of N&V) to
play Rudolph — Davey Crockett will
play repetitively. When you have had
enough, powering down your 08M
circuit will silence Davey.
You may want to take some time
to experiment with some of the other
tune files to see how they sound.
Whenever you want, you can also
read the tune command documentation and try your hand at converting
ringtone files to tune files. If you run
into trouble, let me know and I will see
if I can help. If you have some musical
background, it’s also possible to use
the tune documentation to compose
entire melodies of your own. If you are
successful in doing so and would like
to be “published,” I would be happy to
post your tune on my website.
At this point, we’re going to shift
gears to take a brief look at the 08M’s
IR capabilities. Almost all PICAXE chips
— including the 08M — have powerful
built-in commands for IR input and
output. Let’s begin with IR input.
There are actually three IR input
commands: infrain, infrain2, and irin.
Each of these commands functions with
a different subset of PICAXE processors.
There are some significant differences
between the three IR input commands
(again, refer to the documentation for
details), but all three of them are able to
decode IR signals from any TV remote
capable of transmitting the SIRC (Sony
InfraRed Control) protocol, which not
only includes all Sony IR remotes but also
any universal remote capable of sending
■ FIGURE 2.
the Sony signals.
Over the years, I
have collected six
or seven universal
remotes; when set up
to send signals to a
Sony TV, they all
with the IR project
we are about to discuss. So, just about
any universal remote
should work fine —
just be sure you program your remote
with the correct code
for transmitting Sony
The 08M uses
the infrain2 command, so that’s the
one we’ll focus on. The SIRC protocol
(and many others, as well) transmits its
data by modulating a 38 kHz carrier
wave, so it is necessary to demodulate
this wave to extract the useful information on the receiving end of the IR
link. Fortunately, there are several integrated IR decoder units on the market.
We will be using the Panasonic
+ 5 V 1
10 μF 330
40 or 80 ohm
■ FIGURE 3.
February 2008 75