28825 Parallax Inc, 28825 Datasheet - Page 8

MINI SOUND PLAYER SOUNDPAL

28825

Manufacturer Part Number
28825
Description
MINI SOUND PLAYER SOUNDPAL
Manufacturer
Parallax Inc
Datasheet

Specifications of 28825

Accessory Type
Sound Player
Product
Microcontroller Accessories
Lead Free Status / RoHS Status
Lead free / RoHS Compliant
For Use With/related Products
BASIC Stamp®
For Use With
28824 - SERVOPAL SERVO PULSER TIMER
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
DO
LOOP
Saving Sequences to EEPROM
Once a sequence is loaded into the RAM buffer, it can either be played or saved to EEPROM. The
SoundPAL’s EEPROM has room for 63 bytes of sequence data. You can store one long sequence there or
multiple short sequences. Once saved in EEPROM, a sequence will remain there – even with the power
turned off – until it is overwritten with another sequence. When saving a sequence, you specify the
address in EEPROM where it’s to begin. The entire sequence is saved there, including the zero at the end.
That way, when a saved sequence is played, the SoundPAL knows when it’s finished so it can return to
the calling sequence.
To save a sequence to EEPROM, use the save (#) command, followed by a one-byte address. At this
point, the SoundPAL will begin saving the data. While this is happening, the SoundPAL will be deaf to any
subsequent commands until it’s finished, just as it is when it’s playing a sequence. You can call
WaitDone, though, to tell when its work is done.
In the following example, the first few bars of “Swanee River”, followed by a call to the canned “Intro”
sequence, are saved at location 1. (Fans of old Jackie Gleason “Honeymooners” episodes will recognize
this from the one in which he’s a contestant on “Name That Tune”. He practices with his neighbor,
Norton, at the piano, who prefaces each selection with this sequence. Of course, when he gets to the
studio, the song they play for him to recognize is “Swanee River”, and he is clueless.) Here’s how it’s
saved to EEPROM:
GOSUB DoReset
SEROUT iopin, baud, ["=", tmp0, h+E_0, e+D_0, e+C_0, e+E_0, e+D_0] 'Load to RAM.
SEROUT iopin, baud, [C_0, C_1, e+A_0, C_1, tmp1, play, intro, 0]
WEROUT iopin, baud, ["#", 1]
GOSUB WaitDone
END
To play it back, the following sequence is used:
SEROUT iopin, baud, ["=", play, 1, 0, "!"] 'Play the saved sequence.
Autoplay Mode
When the SoundPAL powers up or resets, the RAM buffer is preprogrammed with a command to play the
sequence at EEPROM address 1. Once a sequence has been programmed there, all you have to do to
play it after powerup or reset is to issue a “!”. To try this, save the sequence, as in the example above,
then do the following:
GOSUB DoReset
SEROUT iopin, baud, ["!"]
But it gets better. If, immediately after reset, the SoundPAL senses that its I/O pin is low, it will
automatically begin execution of the sequence in the RAM buffer, which immediately plays the sequence
at EEPROM address 1. This way, you can store a sequence in EEPROM, then connect the SoundPAL so
that both I/O pins are grounded. Then, whenever the SoundPAL powers up, it will play your
programmed sequence. That way, you don’t even need a BASIC Stamp connected to it to play a canned
© Parallax, Inc. • SoundPAL (2007.10.29)
SEROUT iopin, baud, ["=",oct3,tmp3]
FOR B0 = 1 TO 32
NEXT
SEROUT iopin, baud, [0, "!"]
GOSUB WaitDone
RANDOM W2
SEROUT iopin, baud, [W2 // 31 + $81]
'Save to EEPROM.
Page 8 of 12

Related parts for 28825