28825 Parallax Inc, 28825 Datasheet - Page 9

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
sequence. How about a package with a SoundPAL, a battery, and a limit switch that plays “Happy
Birthday” when the package is opened?
And there’s still more. If you hold the SoundPAL’s I/O pin low, then pulse it high for a few microseconds,
it will play your preprogrammed tune. This will happen every time you send it a short, high pulse, so long
as the low time exceeds 2mS each time. Here’s a short code sequence to illustrate:
LOW iopin
DO
LOOP
This will play your saved sequence once every seven seconds. Notice that we’ve violated the rule not to
drive the I/O pin high. In this case it’s okay, since the high period is so brief; and the SoundPAL won’t try
to drive it low during this time anyway, because it didn’t receive an enquiry command.
SoundPAL Code Template
Here’s the complete code template for the SoundPAL, including all constant definitions, as well as the
DoReset and WaitDone subroutines. It looks quite lengthy, but it takes up only 45 bytes of program
space in a BS2.
' =========================================================================
'
'
'
'
'
'
'
'
'
'
'
' =========================================================================
' -----[ Program Description ]---------------------------------------------
' This is a blank template defining constants and subroutines that
' provide an interface to the Parallax SoundPAL (p/n 28825) Miniature
' Sound Player.
' -----[ I/O Definitions ]-------------------------------------------------
iopin
' -----[ Constants ]-------------------------------------------------------
baud
reset
'Commands
play
repeat
again
'Playing styles
marcato
staccato
legato
glissando CON
'Tempos
© Parallax, Inc. • SoundPAL (2007.10.29)
PAUSE 7000
PULSOUT iopin, 2
File...... SoundPAL_Template.bs2
Purpose... Constants and Standard Subroutines for SoundPAL
Author.... Parallax, Inc.
E-mail.... support@parallax.com
Started... 2007.05.01
Updated... 2007.10.29
{$STAMP BS2}
{$PBASIC 2.5}
PIN
CON
CON
CON
CON
CON
CON
CON
CON
15
$8000 + 84
$8000 + 813
$01
$02
$03
$04
$05
$06
$07
'Play the segment at the following address ($01-$FF).
'Begin a repeat block.
'
'End the repeat block.
'Normal, separated notes.
'Very short notes.
'Connected notes.
'Connected, sliding notes.
'Pin number used for communicaiton with SoundPAL.
'Change as needed.
'Communication baudrate is 9600 for BS2, BS2e, and BS2pe.
'Reset baudrate is 1200 for BS2, BS2e, and BS2pe.
'See BASIC Stamp manual for settings with other Stamps.
Next arg is repeat count (1-254; 255 = endlessly).
Page 9 of 12

Related parts for 28825