BASIC stamp manual v2.2

LCDIN – BASIC Stamp Command Reference
Page 258 BASIC Stamp Syntax and Reference Manual 2.2 www.parallax.com
Explanation
The three LCD commands (LCDCMD, LCDIN and LCDOUT) allow the
BS2p, BS2pe, and BS2px 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.
The LCDIN command is used to send one instruction and then receive at
least one data byte from the LCD's Character Generator RAM or Display
Data RAM. The following is an example of the LCDIN command:
char VAR Byte
LCDIN 0, 128, [char]
The above code will read the character value at location 0 of the DDRAM.
See the "Character Positioning" section, of the LCDCMD command
description on page 252 for more information.
The LCDIN command actually uses more than just the I/O pin specified
by the Pin argument. The LCDIN command requires seven I/O pins. This
is because the standard LCD displays have a parallel interface, rather than
a serial one. The Pin argument can be the numbers 0, 1, 8 or 9 and will
result in the use of the I/O pins shown in Table 5.46. Please refer to the
LCDCMD command description for information on page properly wiring
the LCD display.
When the LCD is first powered-up, it defaults to an 8-bit interface and
must be properly configured for a 4-bit buss 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 LCDCMD command description for information on properly
initializing the LCD display.
The LCDIN command's InputData argument is similar to the SERIN
command's InputData 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).
A
SIMPLE LCDIN EXAMPLE.
T
WO VERY IMPORTANT STEPS:
1)
WIRING THE BASIC STAMP TO AN LCD.
2) INITIALIZING THE LCD.
R
ECEIVING FORMATTED DATA.
NOTE: LCDCMD, LCDIN and
LCDOUT use a 4-bit interface to the
LCD which requires a specific
initialization sequence before LCDIN
and LCDOUT can be used; read more
below.