This repository has been archived on 2024-09-22. You can view files and clone it, but cannot push or open issues or pull requests.
pbi-ide/help/BasicStampHelp/Content/LanguageTopics/Commands/PULSOUT.htm

145 lines
8.1 KiB
HTML
Raw Normal View History

<?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>PULSOUT</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">PULSOUT</h1>
<div class="ImagePlusCaption">
<div class="Col2">
<p>
<img src="../../graphics/pgm_icon1.gif" border="0" alt="BS1 icon" title="BS1 icon" />
<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/PulsoutEx.htm" target="" title="" alt="" class="MCXref_0">PULSOUT Example</a>
</p>
<p>&#160;</p>
</div>
<p class="clear">&#160;</p>
<p>&#160;</p>
<p class="PlainText">Syntax: <span class="keyword_in_text">PULSOUT</span> <![CDATA[ ]]><i>Pin</i>,<i> Duration</i></p>
<h2>Function</h2>
<p class="PlainText">Generate a pulse on <i>Pin</i> with a width of <i>Duration</i>.
</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.</li>
<li value="2"><b><i>Duration</i></b> is a variable/constant/expression* (0 - 65535) that
specifies the duration of the pulse. The unit of time for <i>Duration</i> is
described below.</li>
</ul>
<p class="PlainText">*<img src="../../graphics/bs1note.gif" style="vertical-align: super;" /> Note: expressions are not allowed as arguments on the BS1. The range
of the <i>Pin</i> argument on the BS1 is 07.</p>
<h2>Quick Facts</h2>
<table width="100%" cellpadding="4" cellspacing="0" border="1">
<tr align="center" bgcolor="#CFCFCF">
<td width="16%">&#160;</td>
<td width="12%">BS1</td>
<td width="12%">BS2</td>
<td width="12%">BS2e</td>
<td width="12%">BS2sx</td>
<td width="12%">BS2p</td>
<td width="12%">BS2pe</td>
<td width="12%">BS2px</td>
</tr>
<tr align="center">
<td bgcolor="#CFCFCF">Units in <i>Variable</i></td>
<td>10 µs</td>
<td>2 µs</td>
<td>2 µs</td>
<td>0.8 µs</td>
<td>0.8 µs</td>
<td>2 µs</td>
<td>0.81 µs</td>
</tr>
<tr align="center">
<td align="center" bgcolor="#CFCFCF">Maximum pulse width</td>
<td>655.35 ms</td>
<td>131.07 ms</td>
<td>131.07 ms</td>
<td>52.428 ms</td>
<td>52.428 ms</td>
<td>123.6 ms</td>
<td>53.08 ms</td>
</tr>
<tr>
<td align="center" bgcolor="#CFCFCF">Related Commands</td>
<td align="center" colspan="7">
<p colspan="7" align="center"><a href="PULSIN.htm" target="" title="" alt="" class="MCXref_0">PULSIN</a>
</p>
</td>
</tr>
</table>
<h2>Explanation</h2>
<p class="PlainText"><span class="keyword_in_text">PULSOUT</span> sets <i>Pin</i> to output mode, inverts the state of that pin;
waits for the specified <i>Duration</i>; then inverts the state of the pin again;
returning the bit to its original state. The unit of <i>Duration</i> is described
above. The following example will generate a 100 µs pulse on I/O pin 5: </p><pre class="BScode" xml:space="preserve">
PULSOUT 5, 50 ' generate a pulse on pin 5
</pre>
<p class="PlainText">The polarity of the pulse depends on the state of the pin before the command
executes. In the example above, if pin 5 was low, <span class="keyword_in_text">PULSOUT</span> would produce
a positive pulse. If the pin was high, <span class="keyword_in_text">PULSOUT</span> would produce a negative
pulse.</p>
<p class="PlainText">If the pin is an input, the output state bit, OUT5 (PIN5 on the BS1) won't
necessarily match the state of the pin. What happens then? For example: Pin 7 is
an input (DIR7 = 0) and pulled high by a resistor as shown below. Suppose that
pin 7 is low when we execute the instruction: </p><pre class="BScode" xml:space="preserve">
PULSOUT 7, 5 ' generate a pulse on pin 7
</pre>
<p class="PlainText">The figure below shows the sequence of events on that pin. Initially, pin 7
is high. Its output driver is turned off (because it is in input mode), so the
10 kΩ resistor sets the state on the pin. When <span class="keyword_in_text">PULSOUT</span> executes, it
turns on the output driver, allowing OUT7 (PIN7 on the BS1) to control the pin.</p>
<center>
<img src="../../graphics/pulsout_sch.gif" border="0">
</img>
</center>
<p>&#160;</p>
<p class="PlainText">Since OUT7 (PIN7 on the BS1) is 0, the pin goes low when made an output. After
a few microseconds of preparation, <span class="keyword_in_text">PULSOUT</span> inverts the state of the pin;
from low to high. It leaves the pin in that state for the specified time (10µs
if using a BS2) and then inverts it again, leaving the pin in its original
(output) state. </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 ©&#160;<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>