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/XOUT.htm

199 lines
12 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>XOUT</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">XOUT</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/XoutEx.htm" target="" title="" alt="" class="MCXref_0" xrefformat="{paratext}">XOUT Example</a>
</p>
<p>&#160;</p>
</div>
<p class="clear">&#160;</p>
<p>&#160;</p>
<p class="PlainText">Syntax: <span class="keyword_in_text">XOUT</span> <![CDATA[ ]]><i>Mpin</i>,<i> Zpin</i>,<i><![CDATA[ ]]></i>[<i>House</i>\<i>Command </i>{\<i>Cycles</i>} {,<i> House</i>\<i>Command </i>{\<i>Cycles</i>}...}]</p>
<h2>Function</h2>
<p>Send an X-10 power-line control command (through the appropriate power-line interface).
</p>
<ul>
<li value="1"><b><i>Mpin</i></b> is a variable/constant/expression (0 - 15) that specifies
the I/O pin to output X-10 signals (modulation) to the power-line interface
device. This pin will be set to output mode.</li>
<li value="2"><b><i>Zpin</i></b> is a variable/constant/expression (0 - 15) that specifies
the I/O pin that inputs the zero-crossing signal from the power-line interface
device. This pin will be set to input mode.</li>
<li value="3"><b><i>House</i></b> is a variable/constant/expression (0 - 15) that specifies
the X-10 house code (values 0 - 15 representing letters A through P).</li>
<li value="4"><b><i>Command</i></b> is a variable/constant/expression (0 - 30) that specifies
the command to send. Values 0 - 15 correspond to unit codes 1 - 16. Other
commands are shown below.</li>
<li value="5"><b><i>Cycles</i></b><i>is an optional variable/constant/expression (1 - 255)
specifying the number of times to transmit a given key or command. If no
I&gt;Cycles </i> entry is used, XOUT defaults to two. The <i>Cycles</i> entry
should be used only with the DIM and BRIGHT command codes.</li>
</ul>
<h2>Quick Facts</h2>
<table width="100%" cellpadding="4" cellspacing="0" border="1">
<tr>
<td width="25%" align="center" bgcolor="#CFCFCF">&#160;</td>
<td width="75%" align="center" bgcolor="#CFCFCF">All BS2 Models</td>
</tr>
<tr>
<td align="center" bgcolor="#CFCFCF">Compatible power-line interfaces</td>
<td align="center">PL-513 and TW-523</td>
</tr>
<tr>
<td align="center" bgcolor="#CFCFCF">Special Notes</td>
<td align="left">The <span class="keyword_in_text">XOUT</span> command will stop the BASIC Stamp program
until it is able to send the transmission. If there is no AC power to the
power-line interface, the BASIC Stamp program will halt forever.</td>
</tr>
</table>
<h2>Explanation</h2>
<p class="PlainText"><span class="keyword_in_text">XOUT</span> lets you control appliances via signals sent through household AC wiring
to X-10 modules. The appliances plugged into these modules can be switched on or
off; lights may also be dimmed. Each module is assigned a house code and unit code
by setting dials or switches on the module. To talk to a particular module,
<span class="keyword_in_text">XOUT</span> sends the appropriate house code and unit code. The module with the
corresponding code listens for its house code again followed by a command (on,
off, dim, or bright).</p>
<p class="PlainText">X-10 signals are digital codes imposed on a 120 kHz carrier that is transmitted
during zero crossings of the AC line. To send X-10 commands, a controller must
synchronize to the AC line frequency with 50 ms precision, and transmit an 11-bit
code sequence representing the command.</p>
<p class="PlainText"><span class="keyword_in_text">XOUT</span> interfaces to the AC power-line through an approved interface device
such as a PL-513 or TW-523, available from Parallax or X-10 dealers. The hookup
requires a length of four-conductor phone cable and a standard modular phone-base
connector (6P4C type). Connections are shown below. </p>
<center>
<img src="../../graphics/xout_sch.gif" width="233" height="326" border="0">
</img>
</center>
<table width="100%" cellpadding="4" cellspacing="0" border="1">
<tr>
<td width="20%" align="center" bgcolor="#CFCFCF">Command</td>
<td width="20%" align="center" bgcolor="#CFCFCF">Value</td>
<td width="60%" align="center" bgcolor="#CFCFCF">Function</td>
</tr>
<tr>
<td align="center" bgcolor="#CFCFCF">UnitOn</td>
<td align="center">%10010</td>
<td align="left">Turn on the currently selected unit.</td>
</tr>
<tr>
<td align="center" bgcolor="#CFCFCF">UnitOff</td>
<td align="center">%11010</td>
<td align="left">Turn off the currently selected unit.</td>
</tr>
<tr>
<td align="center" bgcolor="#CFCFCF">UnitsOff</td>
<td align="center">%11100</td>
<td align="left">Turn off all modules in this house code.</td>
</tr>
<tr>
<td align="center" bgcolor="#CFCFCF">LightsOn</td>
<td align="center">%10100</td>
<td align="left">Turn on all lamp modules in this house code.</td>
</tr>
<tr>
<td align="center" bgcolor="#CFCFCF">Dim</td>
<td align="center">%11110</td>
<td align="left">Reduce brightness of currently selected lamp.</td>
</tr>
<tr>
<td align="center" bgcolor="#CFCFCF">Bright</td>
<td align="center">%10110</td>
<td align="left">Increase brightness of currently selected lamp.</td>
</tr>
</table>
<p>&#160;</p>
<p class="Tip" MadCap:autonum="Tip: &#160;"><span class="autonumber"><span class="TipSpan">Tip: &#160;</span></span>In most applications, it's not necessary to know the code for a
given X-10 instruction. Just use the command constant (UnitOn, Dim, etc.) instead.
But knowing the codes leads to some interesting possibilities. For example, XORing
a UnitOn command with the value %1000 turns it into a UnitOff command, and vice-versa.
This makes it possible to write the equivalent of an X-10 "toggle" instruction. </p>
<p class="PlainText">Here is an example of the <span class="keyword_in_text">XOUT</span> instruction: </p><pre class="BScode" xml:space="preserve">
Mpin PIN 1 ' modulation pin
Zpin PIN 0 ' zero-cross input
HouseA CON 0 ' House code A = 0
Unit1 CON 0 ' Unit code 1 = 0
Main:
XOUT Mpin, Zpin, [HouseA\Unit1] ' Get unit 1's attention..
XOUT Mpin, Zpin, [HouseA\UnitOn] ' ..and tell it to turn on
END
</pre>
<p class="PlainText">You can combine those two <span class="keyword_in_text">XOUT</span> instructions into one like so: <br /></p><pre class="BScode" xml:space="preserve">
XOUT Mpin, Zpin, [HouseA\Unit1\2, HouseA\UnitOn]
</pre>
<p class="PlainText">Note that to complete the attention-getting code HouseA\Unit1 we tacked on the
normally optional cycles entry \2 to complete the command before beginning the next
one. Always specify two cycles in multiple commands unless you're adjusting the
brightness of a lamp module. </p>
<p class="PlainText">Here is an example of a lamp-dimming instruction: </p><pre class="BScode" xml:space="preserve">
Mpin PIN 1 ' modulation pin
Zpin PIN 0 ' zero-cross input
HouseA CON 0 ' House code A = 0
Unit1 CON 0 ' Unit code 1 = 0
Main:
' Get unit 1's attention
XOUT Mpin, Zpin, [HouseA\Unit1]
' Dim halfway
XOUT Mpin, Zpin, [HouseA\UnitOff\2, HouseA\Dim\10]
END
</pre>
<p class="PlainText">The dim/bright commands support 19 brightness levels. Lamp modules may also be
turned on and off using the standard UnitOn and UnitOff commands. In the example
instruction above, we dimmed the lamp by first turning it completely off, then
sending 10 cycles of the Dim command. This may seem odd, but it follows the
peculiar logic of the X-10 system. </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>