201 lines
11 KiB
HTML
201 lines
11 KiB
HTML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
<html xmlns:MadCap="http://www.madcapsoftware.com/Schemas/MadCap.xsd" MadCap:lastBlockDepth="6" MadCap:lastHeight="94" MadCap:lastWidth="853" MadCap:disableMasterStylesheet="true" MadCap:tocPath="" MadCap:InPreviewMode="false" MadCap:PreloadImages="false" MadCap:RuntimeFileType="Topic" MadCap:TargetType="WebHelp" lang="en-us" xml:lang="en-us" MadCap:PathToHelpSystem="../../../" MadCap:HelpSystemFileName="Default.xml" MadCap:SearchType="Stem">
|
|
<head><title>DTMFOUT</title>
|
|
<link href="../../SkinSupport/MadCap.css" rel="stylesheet" />
|
|
<link href="../../Resources/Stylesheets/BSE_Help.css" rel="stylesheet" />
|
|
<script src="../../SkinSupport/MadCapAll.js" type="text/javascript">
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<h1 class="code">DTMFOUT</h1>
|
|
<div class="ImagePlusCaption">
|
|
<div class="Col2">
|
|
<p>
|
|
<img src="../../graphics/pgm_icon2.gif" border="0" alt="BS2 icon" title="BS2 icon" />
|
|
<img src="../../graphics/pgm_icon2e.gif" border="0" alt="BS2e icon" title="BS2e icon" />
|
|
<img src="../../graphics/pgm_icon2sx.gif" border="0" alt="BS2sx icon" title="BS2sx icon" />
|
|
<img src="../../graphics/pgm_icon2p.gif" border="0" alt="BS2p icon" title="BS2p icon" />
|
|
<img src="../../graphics/pgm_icon2pe.gif" border="0" alt="BS2pe icon" title="BS2pe icon" />
|
|
<img src="../../graphics/pgm_icon2px.gif" border="0" alt="BS2px icon" title="BS2px icon" />
|
|
</p>
|
|
</div>
|
|
<p style="text-align: right;"><a href="../ExampleTopics/DtmfoutEx.htm" target="" title="" alt="" class="MCXref_0" xrefformat="{paratext}">DTMFOUT Example</a>
|
|
</p>
|
|
<p> </p>
|
|
</div>
|
|
<p class="clear"> </p>
|
|
<p> </p>
|
|
<p class="PlainText">Syntax: <span class="keyword_in_text">DTMFOUT</span> <![CDATA[ ]]><i>Pin</i>, {<i>OnTime</i>,<i> OffTime</i>,} [<i>Tone
|
|
</i>{,<i> Tone...</i>}]</p>
|
|
<h2>Function</h2>
|
|
<p class="PlainText">Generate dual-tone, multi-frequency tones (DTMF, i.e., telephone "touch" tones).
|
|
|
|
</p>
|
|
<ul>
|
|
<li value="1"><b><i>Pin</i></b> is a variable/constant/expression (0 - 15) that specifies
|
|
the I/O pin to use. This pin will be set to output mode during generation of
|
|
tones and set to input mode afterwards.</li>
|
|
<li value="2"><b><i>OnTime</i></b> is an optional variable/constant/expression (0 - 65535)
|
|
specifying a duration of the tone. The unit of time and the default time for
|
|
<i>OnTime</i> is described below. </li>
|
|
<li value="3"><b><i>OffTime</i></b> is an optional variable/constant/expression (0 - 65535)
|
|
specifying the length of silent pause after a tone (or between tones, if
|
|
multiple tones are specified). The unit of time and the default time for
|
|
<i>OffTime</i> is described below.</li>
|
|
<li value="4"><b><i>Tone</i></b> is a variable/constant/expression (0 - 15) specifying the
|
|
DTMF tone to generate. Tones 0 through 11 correspond to the standard layout
|
|
of the telephone keypad, while 12 through 15 are the fourth-column tones used
|
|
by phone test equipment and in ham-radio applications. </li>
|
|
</ul>
|
|
<h2>Quick Facts<br /></h2>
|
|
<table width="100%" cellpadding="4" cellspacing="0" border="1">
|
|
<tr>
|
|
<td width="20%" align="center" bgcolor="#CFCFCF"> </td>
|
|
<td width="16%" align="center" bgcolor="#CFCFCF">BS2 / BS2e</td>
|
|
<td width="16%" align="center" bgcolor="#CFCFCF">BS2sx</td>
|
|
<td width="16%" align="center" bgcolor="#CFCFCF">BS2p</td>
|
|
<td width="16%" align="center" bgcolor="#CFCFCF">BS2pe</td>
|
|
<td width="16%" align="center" bgcolor="#CFCFCF">BS2px</td>
|
|
</tr>
|
|
<tr>
|
|
<td align="center" bgcolor="#CFCFCF">Default <i>OnTime</i></td>
|
|
<td align="center">200 ms</td>
|
|
<td align="center">80 ms</td>
|
|
<td align="center">55 ms</td>
|
|
<td align="center">196 ms</td>
|
|
<td align="center">34 ms</td>
|
|
</tr>
|
|
<tr>
|
|
<td align="center" bgcolor="#CFCFCF">Default <i>OffTime</i></td>
|
|
<td align="center">50 ms</td>
|
|
<td align="center">50 ms</td>
|
|
<td align="center">50 ms</td>
|
|
<td align="center">50 ms</td>
|
|
<td align="center">50 ms</td>
|
|
</tr>
|
|
<tr>
|
|
<td align="center" bgcolor="#CFCFCF">Units in <i>OnTime</i></td>
|
|
<td align="center">1 ms</td>
|
|
<td align="center">0.4 ms</td>
|
|
<td align="center">0.265 ms</td>
|
|
<td align="center">1 ms</td>
|
|
<td align="center">0.166 ms</td>
|
|
</tr>
|
|
<tr>
|
|
<td align="center" bgcolor="#CFCFCF">Units in <i>OffTime</i></td>
|
|
<td align="center">1 ms</td>
|
|
<td align="center">1 ms</td>
|
|
<td align="center">1 ms</td>
|
|
<td align="center">1 ms</td>
|
|
<td align="center">1 ms</td>
|
|
</tr>
|
|
<tr>
|
|
<td align="center" bgcolor="#CFCFCF">Related Commands</td>
|
|
<td align="center" colspan="5">
|
|
<p colspan="5" align="center"><a href="SOUND.htm" target="" title="" alt="" class="MCXref_0" xrefformat="{paratext}">SOUND</a>,  <a href="FREQOUT.htm" target="" title="" alt="" class="MCXref_0" xrefformat="{paratext}">FREQOUT</a></p>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<h2>Explanation</h2>
|
|
<p class="PlainText">DTMF tones are used to dial the phone or remotely control certain radio equipment.
|
|
The BASIC Stamp can generate these tones digitally using the <span class="keyword_in_text">DTMFOUT</span>
|
|
instruction. </p>
|
|
<p class="PlainText">This figure shows how to connect an audio amplifier or speaker to hear these
|
|
tones:</p>
|
|
<center>
|
|
<img src="../../graphics/freqout_sch.gif" border="0">
|
|
</img>
|
|
</center>
|
|
<p class="PlainText">...and this figure shows how to connect the BASIC Stamp to the phone line:</p>
|
|
<center>
|
|
<img src="../../graphics/daa_sch.gif" border="0">
|
|
</img>
|
|
</center>
|
|
<p class="PlainText">The following <span class="keyword_in_text">DTMFOUT</span> instruction will generate DTMF tones on I/O pin 0:
|
|
|
|
</p><pre class="BScode" xml:space="preserve">
|
|
' Call Parallax
|
|
DTMFOUT 0, [1, 9, 1, 6, 6, 2, 4, 8, 3, 3, 3]
|
|
</pre>
|
|
<p class="PlainText">If the BASIC Stamp is connected to the phone line properly, the above command
|
|
would be equivalent to dialing 1-916-624-8333 from a phone keypad. If you wanted
|
|
to slow the pace of the dialing to accommodate a noisy phone line or radio link,
|
|
you could use the optional <i>OnTime</i> and <i>OffTime</i> values:
|
|
|
|
</p><pre class="BScode" xml:space="preserve">
|
|
' Call Parallax; dial slowly.
|
|
DTMFOUT 0, 500, 100, [1, 9, 1, 6, 6, 2, 4, 8, 3, 3, 3]
|
|
</pre>
|
|
<p>In this example, on a BS2 the<i>OnTime</i> is set to 500 ms (1/2 second) and <i>OffTime</i> to 100 ms (1/10th second).</p>
|
|
<p> </p>
|
|
<center>
|
|
<table cellpadding="4" cellspacing="0" border="1">
|
|
<tr>
|
|
<td align="center" width="75" bgcolor="#CFCFCF">Tone Value</td>
|
|
<td align="center" width="250" bgcolor="#CFCFCF">Corresponding Telephone Key</td>
|
|
</tr>
|
|
<tr>
|
|
<td align="center">0 - 9</td>
|
|
<td align="center">Digits 0 through 9</td>
|
|
</tr>
|
|
<tr>
|
|
<td align="center">10</td>
|
|
<td align="center">Star (*)</td>
|
|
</tr>
|
|
<tr>
|
|
<td align="center">11</td>
|
|
<td align="center">Pound (#)</td>
|
|
</tr>
|
|
<tr>
|
|
<td align="center">12 - 15</td>
|
|
<td align="center">Fourth column tones A through D</td>
|
|
</tr>
|
|
</table>
|
|
</center>
|
|
<p class="PlainText"> </p>
|
|
<p class="PlainText">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 the figures above is to smooth out the
|
|
high-frequency PWM, leaving only the lower frequency audio behind. </p>
|
|
<p class="PlainText">Keep this in mind if you want to interface a BASIC Stamp module'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
|
|
above are only a starting point; you may want to use an active low-pass filter
|
|
with a roll-off point around 2 kHz.</p>
|
|
<div class="Col2">
|
|
<div class="MasterFoot">
|
|
<p MadCap:conditions="BSEconditions.BSEWebHelp (Primary)-INCLUDE"><a href="../../HomeTopics/HomePage.htm">Go to Welcome page</a>
|
|
</p>
|
|
</div>
|
|
</div>
|
|
<div class="Col2">
|
|
<div class="MasterFoot">
|
|
<p style="text-align: right;"><span class="ContactInfoProjectName">BASIC Stamp Help</span> <![CDATA[ ]]><span class="ContactInfoVersion#">Version 2.5.4</span> <![CDATA[ ]]></p>
|
|
<p style="text-align: right;">Copyright © <span class="ContactInfoCompanyName">Parallax Inc.</span></p>
|
|
<p style="text-align: right;"><span class="SystemShortDate">8/8/2012</span>
|
|
</p>
|
|
</div>
|
|
</div>
|
|
<script type="text/javascript">/* <![CDATA[ */
|
|
|
|
var _gaq = _gaq || [];
|
|
_gaq.push(['_setAccount', 'UA-285614-1']);
|
|
_gaq.push(['_trackPageview']);
|
|
|
|
(function() {
|
|
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
|
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
|
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
|
})();
|
|
|
|
/* ]]> */</script>
|
|
<script type="text/javascript" src="../../SkinSupport/MadCapBodyEnd.js">
|
|
</script>
|
|
</body>
|
|
</html> |