BASIC stamp manual v2.2
5: BASIC Stamp Command Reference – FREQOUT
BASIC Stamp Syntax and Reference Manual 2.2 • www.parallax.com • Page 199
FREQOUT
BS1 BS2 BS2e BS2sx BS2p BS2pe BS2px
(See SOUND)
FREQOUT Pin, Duration, Freq1 { , Freq2 }
Function
Generate one or two sine-wave tones for a specified Duration.
• Pin is a variable/constant/expression (0 – 15) that specifies the I/O
pin to use. This pin will be set to output mode.
• Duration is a variable/constant/expression (0 - 65535) specifying the
amount of time to generate the tone(s). The unit of time for Duration
is described in Table 5.26.
• Freq1 is a variable/constant/expression (0 – 32767) specifying
frequency of the first tone. The unit of Freq1 is described in Table
5.26.
• Freq2 is an optional argument exactly like Freq1. When specified,
two frequencies will be mixed together on the specified I/O pin.
Quick Facts
Table 5.26: FREQOUT Quick
Facts.
BS2, BS2e BS2sx BS2p BS2pe BS2px
Units in
Duration
1 ms 0.4 ms 0.265 ms 1 ms 0.166 ms
Units in
Freq1 and
Freq2
1 Hz 2.5 Hz 3.77 Hz 1.51 Hz 6.03 Hz
Range of
Frequency
0 to 32767 Hz 0 to 81917 Hz 0 to 123531 Hz 0 to 49478 Hz 0 to 197585 Hz
Related
Commands
DTMFOUT and PWM
Explanation
FREQOUT generates one or two sine waves using a pulse-width
modulation algorithm. The circuits shown in Figure 5.6 will filter the
signal in order to play the tones through a speaker or audio amplifier.
Here’s a simple FREQOUT command:
FREQOUT 2, 1000, 2500
S
IMPLEST FORM OF FREQOUT.
1
All
2