PUTTING THE SPOTLIGHT ON BASIC STAMP PROJECTS, HINTS & TIPS
■ BY JON WILLIAMS
EXPERIMENTS WITH SOUND
IT WOULD BE MORE THAN FAIR TO SAY THAT I’M A LIGHT SLEEPER. To be honest,
I don’t think that I have ever slept for more than a couple hours at a stretch.
Don’t get me wrong, I tie a few of those stretches together each night (well,
most nights) so that I’m rested in the morning, but I’m certain that I have never
slept all the way through the night. I’m not talking about tossing and turning,
mind you, I’m talking about full wake-up — usually at the end of a vivid dream
or nightmare. A friend had told me that she can tell her husband to be quiet
when he is snoring or talking in his sleep and he will obey. Well, I don’t have a
wife or girlfriend, so I guess I’ll just turn to technology. How sad am I?
Well, not too sad, thankfully, as I have many wonderful
friends. One of those friends is a guy you Halloween
enthusiasts have probably heard of — “Scary” Terry
Simmons. Let me just say for the record that he is anything
but scary; Terry is one of the nicest people I’ve ever
known, and having been a guest in his home on several
occasions, I can say that with some authority.
A couple months ago, Terry asked for a bit of help
with the Vinculum VMUSIC2 MP3 player. I’d seen it, but
hadn’t really paid much attention to it until Terry thought
he’d give it a go with the BS1, the BS2, and even the SX.
So, I bought one and found that it’s really kind of neat —
my experiments with it and its quirks are going to be the
focus here. No PCB to worry about for this article, we’re
just going to play. Just a VMUSIC2, a USB memory stick,
and your favorite SX prototyping setup is all you’ll need.
So, getting back to the sleep thing, what I’m going to
do is put together a little circuit — albeit temporary until it
proves — that will play audio while I’m sleeping to keep
me from waking up. Perhaps I’ll plant some suggestions in
the audio to help me achieve my personal goals; a sleeping
hypnosis device — that’s it, we’ll call it Sleepnotizer!
The VMUSIC2 is a little demonstration unit that allows
you to play MP3 audio files from a USB memory stick.
It is easily controlled through a serial or SPI type interface
— we’re going to use serial as it seems the most straightforward. When using serial mode, the VMUSIC2 is typically
configured to accept text commands as if one was
sending them from a terminal. So making the thing work
is actually pretty simple. What I did was go through an
60 September 2008
instruction set and create SX/B subroutines and functions
that encapsulated the various features.
To give you an idea how easy the device is to use,
we could play a file called firefly.mp3 with a couple of
TX_STR “VPF firefly.mp3”
What we’ll do, of course, is wrap this code into a nice
subroutine where all we have to do is pass the name of
the file (without extension).
GOING WITH THE FLOW
Looking at the VMUSIC2 connections, you’ll see that
it typically exerts hardware flow control. This means it will
bring its RTS line low when its buffer has available space
and it will stop transmitting when its CTS input goes high
— this would signal that our receive buffer is presently full.
Adding flow control to the VP UARTS we’ve used in
previous projects turned out to be trivial — here’s what it
looks like on the receive end:
JB rxBufCnt.4, RX_Done
MOVB C, RX
MOV W, #9
MOV rxCount, W
MOV rxDivide, #Baud1x5