293 lines
17 KiB
HTML
293 lines
17 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>LCDIN</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">LCDIN</h1>
|
|
<div class="ImagePlusCaption">
|
|
<div class="Col2">
|
|
<p>
|
|
<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/LcdinEx.htm" target="" title="" alt="" class="MCXref_0" xrefformat="{paratext}">LCDIN Example</a>
|
|
</p>
|
|
<p> </p>
|
|
</div>
|
|
<p class="clear"> </p>
|
|
<p> </p>
|
|
<p class="PlainText">Syntax: <span class="keyword_in_text">LCDIN</span> <![CDATA[ ]]><i>Pin</i>,<i> Command</i>, [<i>InputData</i>]</p>
|
|
<h2>Function</h2>
|
|
<p class="PlainText">Receive data from an LCD display.
|
|
|
|
</p>
|
|
<ul>
|
|
<li value="1"><b><i>Pin</i></b> is a variable/constant/expression (0 - 1 or 8 - 9) that
|
|
specifies which I/O pins to use. The LCD requires, at most, seven I/O pins to
|
|
operate. The <i>Pin</i> argument serves a double purpose; specifying the first
|
|
pin and, indirectly, the group of other required pins. See explanation below.
|
|
All I/O pins will be set to output mode initially and the upper I/O pins (4 -
|
|
7 or 12 - 15) will be set to input mode by the end of the <span class="keyword_in_text">LCDIN</span> command.</li>
|
|
<li value="2"><b><i>Command</i></b> is a variable/constant/expression (0 - 255) indicating
|
|
the LCD command to send.</li>
|
|
<li value="3"><b><i>InputData</i></b> is a list of variables and formatters that tells
|
|
<span class="keyword_in_text">LCDIN</span> what to do with incoming data. <span class="keyword_in_text">LCDIN</span> can store data in a
|
|
variable or array, interpret numeric text (decimal, binary, or hex) and store
|
|
the corresponding value in a variable, wait for a fixed or variable sequence
|
|
of bytes, or ignore a specified number of bytes. These actions can be combined
|
|
in any order in the <i>InputData</i> list.</li>
|
|
</ul>
|
|
<h2>Quick Facts</h2>
|
|
<table cellpadding="4" cellspacing="0" border="1">
|
|
<tr bgcolor="#CFCFCF">
|
|
<td width="275" align="center"> </td>
|
|
<td width="1200" align="center">BS2p, BS2pe, and BS2px</td>
|
|
</tr>
|
|
<tr>
|
|
<td align="center" bgcolor="#CFCFCF">Values for <i>Pin</i></td>
|
|
<td align="center">0, 1, 8, or 9</td>
|
|
</tr>
|
|
<tr>
|
|
<td align="center" bgcolor="#CFCFCF">I/O pin arrangement when<br></br><i>Pin</i> is
|
|
0 or 1</td>
|
|
<td>0 or 1 (depending on <i>Pin</i>) : LCD Enable (E) pin<br></br> 2 : LCD Read/Write (R/W) pin<br></br> 3 : LCD Register Select (RS) pin<br></br> 4 - 7 : LCD Data Bus (DB4 - DB7, respectively) pins</td>
|
|
</tr>
|
|
<tr>
|
|
<td align="center" bgcolor="#CFCFCF">I/O pin arrangement when<br></br><i>Pin</i> is
|
|
8 or 9</td>
|
|
<td>8 or 9 (depending on <i>Pin</i>) : LCD Enable (E) pin<br></br> 10 : LCD Read/Write (R/W) pin<br></br> 11 : LCD Register Select (RS) pin<br></br> 12 - 15 : LCD Data Bus (DB4 - DB7, respectively) pins</td>
|
|
</tr>
|
|
<tr>
|
|
<td align="center" bgcolor="#CFCFCF">Special Notes</td>
|
|
<td align="center" colspan="1"><span class="keyword_in_text">LCDIN </span>is designed to use the LCD's 4-bit mode only.</td>
|
|
</tr>
|
|
<tr>
|
|
<td align="center" bgcolor="#CFCFCF">Related Commands</td>
|
|
<td align="center" colspan="1">
|
|
<p colspan="1" align="center"><a href="LCDCMD.htm" target="" title="" alt="" class="MCXref_0" xrefformat="{paratext}">LCDCMD</a>, <a href="LCDOUT.htm" target="" title="" alt="" class="MCXref_0" xrefformat="{paratext}">LCDOUT</a></p>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<h2>Explanation</h2>
|
|
<p class="PlainText">The three LCD commands (<span class="keyword_in_text">LCDCMD</span>, <span class="keyword_in_text">LCDIN</span> and <span class="keyword_in_text">LCDOUT</span>) allow the
|
|
BS2p, BS2pe, or BS2pe to interface directly to standard LCD displays that feature
|
|
a Hitachi 44780 controller (part #HD44780A). This includes many 1 x 16, 2 x 16,
|
|
and 4 x 20 character LCD displays. Note that <span class="keyword_in_text">LCDCMD</span>, <span class="keyword_in_text">LCDIN</span> and
|
|
<span class="keyword_in_text">LCDOUT</span> use a 4-bit interface to the LCD which requires a specific
|
|
initialization sequence before <span class="keyword_in_text">LCDIN</span> and <span class="keyword_in_text">LCDOUT</span> can be used
|
|
(see <a href="LCDCMD.htm" target="" title="" alt="" class="MCXref_0" xrefformat="{paratext}">LCDCMD</a> for initialization details).</p>
|
|
<p class="PlainText">The <span class="keyword_in_text">LCDIN</span> command is used to send one instruction and then receive at
|
|
least one data byte from the LCD's Character Generator RAM (CGRAM) or Display Data
|
|
RAM (DDRAM). The following is an example of the <span class="keyword_in_text">LCDIN</span> command:</p><pre class="BScode" xml:space="preserve">
|
|
char VAR Byte
|
|
|
|
Main:
|
|
LCDIN 1, 128, [char]
|
|
STOP
|
|
</pre>
|
|
<p class="PlainText">The preceding example will read the character value at location 0 of the DDRAM.
|
|
See the "Character Positioning" section, below, for more information.</p>
|
|
<p class="PlainText">The <span class="keyword_in_text">LCDIN</span> command actually uses more than just the I/O pin specified by
|
|
the <i>Pin</i> argument. The <span class="keyword_in_text">LCDIN</span> command requires seven I/O pins. This
|
|
is because the standard LCD displays have a parallel interface, rather than a
|
|
serial one. The <i>Pin</i> argument can be the numbers 0, 1, 8, or 9 and will
|
|
result in the use of the I/O pins shown above. Please refer to the
|
|
<a href="LCDCMD.htm" target="" title="" alt="" class="MCXref_0" xrefformat="{paratext}">LCDCMD</a> command description for information on properly
|
|
wiring the LCD display.</p>
|
|
<p class="PlainText">When the LCD is first powered-up, it will be in an unknown state and must be
|
|
properly configured before sending commands like the one shown above. This process
|
|
is known as initializing the LCD and is the first thing your program should do
|
|
upon starting up. Please refer to the <a href="LCDCMD.htm" target="" title="" alt="" class="MCXref_0" xrefformat="{paratext}">LCDCMD</a> command
|
|
description for information on properly initializing the LCD display. </p>
|
|
<p class="PlainText">The <span class="keyword_in_text">LCDIN</span> command's <i>InputData</i> argument is similar to the <span class="keyword_in_text">SERIN</span> command's <i>InputData</i> argument. This means data can be received as ASCII
|
|
character values, decimal, hexadecimal and binary translations and string data as
|
|
in the examples below (assume the LCD display has "Value: 3A:101" starting at the
|
|
first character of the first line on the screen).</p><pre class="BScode" xml:space="preserve">
|
|
value VAR Byte(13)
|
|
|
|
Main:
|
|
LCDIN 1, 128, [value] ' receive ASCII code for "V"
|
|
LCDIN 1, 128, [DEC value] ' receive the number 3
|
|
LCDIN 1, 128, [HEX value] ' receive the number $3A
|
|
LCDIN 1, 128, [BIN value] ' receive the number %101
|
|
LCDIN 1, 128, [STR value\13] ' receive the string "Value: 3A:101"
|
|
</pre>
|
|
<p class="PlainText">The tables below list all the available conversion formatters and special
|
|
formatters available to the <span class="keyword_in_text">LCDIN</span> command. See the
|
|
<a href="SERIN.htm" target="" title="" alt="" class="MCXref_0" xrefformat="{paratext}">SERIN</a> command for additional information and examples
|
|
of their use.</p>
|
|
<table width="100%" cellpadding="4" cellspacing="0" border="1">
|
|
<tr bgcolor="#CFCFCF" align="center" valign="top">
|
|
<td width="15%">Conversion Formatter</td>
|
|
<td width="45%">Type of Number</td>
|
|
<td width="30%">Numeric Characters Accepted</td>
|
|
<td width="10%">Notes</td>
|
|
</tr>
|
|
<tr align="center">
|
|
<td>DEC{1..5}</td>
|
|
<td>Decimal, optionally limited to 1 - 5 digits</td>
|
|
<td>0 through 9</td>
|
|
<td>1</td>
|
|
</tr>
|
|
<tr align="center">
|
|
<td>SDEC{1..5}</td>
|
|
<td>Signed decimal, optionally limited to 1 - 5 digits</td>
|
|
<td>-, 0 through 9</td>
|
|
<td>1,2</td>
|
|
</tr>
|
|
<tr align="center">
|
|
<td>HEX{1..4}</td>
|
|
<td>Hexadecimal, optionally limited to 1 - 4 digits</td>
|
|
<td>0 through 9, A through F</td>
|
|
<td>1,3</td>
|
|
</tr>
|
|
<tr align="center">
|
|
<td>SHEX{1..4}</td>
|
|
<td>Signed hexadecimal, optionally limited to 1 - 4 digits </td>
|
|
<td>-, 0 through 9, A through F</td>
|
|
<td>1,2,3</td>
|
|
</tr>
|
|
<tr align="center">
|
|
<td>IHEX{1..4}</td>
|
|
<td>Indicated hexadecimal, optionally limited to 1 - 4 digits</td>
|
|
<td>$, 0 through 9, A through F</td>
|
|
<td>1,3,4</td>
|
|
</tr>
|
|
<tr align="center">
|
|
<td>ISHEX{1..4}</td>
|
|
<td>Signed, indicated hexadecimal, optionally limited to 1 - 4 digits</td>
|
|
<td>-, $, 0 through 9, A through F</td>
|
|
<td>1,2,3,4</td>
|
|
</tr>
|
|
<tr align="center">
|
|
<td>BIN{1..16}</td>
|
|
<td>Binary, optionally limited to 1 - 16 digits</td>
|
|
<td>0, 1</td>
|
|
<td>1</td>
|
|
</tr>
|
|
<tr align="center">
|
|
<td>SBIN{1..16}</td>
|
|
<td>Signed binary, optionally limited to 1 - 16 digits</td>
|
|
<td>-, 0, 1</td>
|
|
<td>1,2</td>
|
|
</tr>
|
|
<tr align="center">
|
|
<td>IBIN{1..16}</td>
|
|
<td>Indicated binary, optionally limited to 1 - 16 digits</td>
|
|
<td>%, 0, 1</td>
|
|
<td>1,4</td>
|
|
</tr>
|
|
<tr align="center">
|
|
<td>ISBIN{1..16}</td>
|
|
<td>Signed, indicated binary, optionally limited to 1 - 16 digits</td>
|
|
<td>-, %, 0, 1</td>
|
|
<td>1,2,4</td>
|
|
</tr>
|
|
<tr align="center">
|
|
<td>NUM</td>
|
|
<td>Generic numeric input; hex or binary number must be indicated</td>
|
|
<td>$, %, 0 through 9, A through F</td>
|
|
<td>1,3,4</td>
|
|
</tr>
|
|
<tr align="center">
|
|
<td>SNUM</td>
|
|
<td>Similar to NUM with value treated as signed with range -32768 to +32767</td>
|
|
<td>-, $, %, 0 through 9, A through F</td>
|
|
<td>1,2,3,4</td>
|
|
</tr>
|
|
</table>
|
|
<ol>
|
|
<li value="1">All numeric conversions will continue to accept new data until receiving
|
|
either the specified number of digits (ex: three digits for DEC3) or a
|
|
non-numeric character.</li>
|
|
<li value="2">To be recognized as part of a number, the minus sign (-) must immediately
|
|
precede a numeric character. The minus sign character occurring in non-numeric
|
|
text is ignored and any character (including a space) between a minus and a
|
|
number causes the minus to be ignored.</li>
|
|
<li value="3">The hexadecimal formatters are not case-sensitive; "a" through "f" means
|
|
the same as "A" through "F".</li>
|
|
<li value="4">Indicated hexadecimal and binary formatters ignore all characters, even
|
|
valid numerics, until they receive the appropriate prefix ($ for hexadecimal,
|
|
% for binary). The indicated formatters can differentiate between text and
|
|
hexadecimal (ex: ABC would be interpreted by HEX as a number but IHEX would
|
|
ignore it unless expressed as $ABC). Likewise, the binary version can
|
|
distinguish the decimal number 10 from the binary number %10. A prefix
|
|
occurring in non-numeric text is ignored, and any character (including a
|
|
space) between a prefix and a number causes the prefix to be ignored. Indicated,
|
|
signed formatters require that the minus sign come before the prefix, as
|
|
in -$1B45.</li>
|
|
</ol>
|
|
<table width="100%" cellpadding="4" cellspacing="0" border="1">
|
|
<tr bgcolor="#CFCFCF" align="center" valign="top">
|
|
<td width="20%">Special Formatter</td>
|
|
<td width="80%">Action</td>
|
|
</tr>
|
|
<tr>
|
|
<td align="center">STR ByteArray \L {\E}</td>
|
|
<td>Input a character string of length L into an array. If specified, an end
|
|
character E causes the string input to end before reaching length L.
|
|
Remaining bytes are filled with 0s (zeros).</td>
|
|
</tr>
|
|
<tr>
|
|
<td align="center">WAITSTR ByteArray {\L}</td>
|
|
<td>Wait for a sequence of bytes matching a string stored in an array
|
|
variable, optionally limited to L characters. If the optional L argument is
|
|
left off, the end of the array-string must be marked by a byte containing a
|
|
zero (0).</td>
|
|
</tr>
|
|
<tr>
|
|
<td align="center">SKIP Length</td>
|
|
<td>Ignore Length bytes of characters.</td>
|
|
</tr>
|
|
<tr>
|
|
<td align="center">SPSTR Length</td>
|
|
<td>Buffer Length bytes (up to 126) of serial characters to Scratchpad RAM,
|
|
starting at location 0. Use <a href="GET.htm" target="" title="" alt="" class="MCXref_0" xrefformat="{paratext}">GET</a> to retrieve the
|
|
characters.</td>
|
|
</tr>
|
|
</table>
|
|
<p> </p>
|
|
<p class="PlainText">Some possible uses of the <span class="keyword_in_text">LCDIN</span> command are 1) in combination with the
|
|
<span class="keyword_in_text">LCDOUT</span> command to store and read data from the unused DDRAM or CGRAM
|
|
locations (as extra variable space), 2) to verify that the data from a previous
|
|
<span class="keyword_in_text">LCDOUT</span> command was received and processed properly by the LCD, and 3) to
|
|
read character data from CGRAM for the purposes of modifying it and storing it
|
|
as a custom character.</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> |