T
B
.
ECHNICAL
ACKGROUND
Figure 5.3: Example DAA Circuit to
Interface to a Standard Telephone
Line.
2
2
e
NOTE: This is written for the BS2
but can be used for the BS2e,
BS2sx and BS2p also. Locate the
proper source code file or modify
the STAMP directive before
downloading to the BS2e, BS2sx or
BS2p.
5: BASIC Stamp Command Reference - DTMFOUT
The BASIC Stamp controller 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 Figures 5.2 and 5.3 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.2 are only a starting
point; you may want to use an active low-pass filter with a roll-off point
around 2 kHz.
connect switch (or
relay contacts)
phone line
(red and green)
Digi-Key (DK), 1-800-344-4539
or 218-681-6674
2
2
Demo Program (DTMFOUT.bs2)
p
sx
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 a phone number is marked by the nibble $F, since this is not a valid phone-dialing
digit.
'{$STAMP BS2}
'-----Define variables-----
EEloc
VAR
EEByte
VAR
Interfacing to the Telephone Line
600-600 Ω
transformer
(JC: 117760)
10 Ω
(both)
270V "Sidactor"
(DK: P3000AA61-ND
3.9V zeners (both)
P3000AA61-ND)
DK: 1N5228BCT-ND
Jameco (JC), 1-800-831-4242
or 415-592-8097
BYTE
BYTE
BASIC Stamp Programming Manual 2.0c • www.parallaxinc.com • Page 109
0.1 µ F
1 k
Ω
0.001 µ F
Vss
'STAMP directive (specifies a BS2)
' EEPROM address of stored number.
' Byte containing two DTMF digits.
from I/O pin
Need help?
Do you have a question about the BASIC Stamp 2e and is the answer not in the manual?