BASIC stamp manual v2.2

5: BASIC Stamp Command Reference – DTMFOUT
BASIC Stamp Syntax and Reference Manual 2.2 www.parallax.com Page 181
The BASIC Stamp microcontroller is a purely digital device. DTMF tones
are analog waveforms, consisting of a mixture of two sine waves at
different audio frequencies. So how does a digital device generate analog
output? The BASIC Stamp creates and mixes the sine waves
mathematically, then uses the resulting stream of numbers to control the
duty cycle of a very fast pulse-width modulation (PWM) routine. So
what’s actually coming out of the I/O pin is a rapid stream of pulses. The
purpose of the filtering arrangements shown in Figure 5.4 and Figure 5.5 is
to smooth out the high-frequency PWM, leaving only the lower frequency
audio behind.
Keep this in mind if you want to interface BASIC Stamp's DTMF output to
radios and other equipment that could be adversely affected by the
presence of high-frequency noise on the input. Make sure to filter the
DTMF output thoroughly. The circuits in Figure 5.4 are only a starting
point; you may want to use an active low-pass filter with a roll-off point
around 2 kHz.
Figure 5.5: Example DAA Circuit to
Interface to a Standard Telephone
Line.
Jameco (JC), 1-800-831-4242
or 415-592-8097
Interfacing to the Telephone Line
600-600
transformer
(JC: 117760)
270V “Sidactor”
(DK: P3000AA61-ND
P3000AA61-ND)
10
(both)
3.9V zeners (both)
DK: 1N5228BCT-ND
phone line
(red and green)
0.001
µ
F
0.1
µ
F1 k
connect switch (or
relay contacts)
Digi-Key (DK), 1-800-344-4539
or 218-681-6674
from I/O pin
Vss
Demo Program (DTMFOUT.bs2)
' DTMFOUT.bs2
' This demo program is a rudimentary memory dialer. Since DTMF digits fit
' within a nibble (four bits), the program below packs two DTMF digits into
' each byte of three EEPROM data tables. The end of phone number is marked
' by the nibble $F, since this is not a valid phone-dialing digit.
' Conditional compilation sets the timing adjustment factor so that the
' output will sound the same on any BS2 model.
T
ECHNICAL BACKGROUND.
NOTE: This example program can be
used with all BS2 models. This program
uses conditional compilation techniques;
see Chapter 3 for more information.
All
2