27220 Parallax Inc, 27220 Datasheet - Page 102

BOOK STAMPWORKS

27220

Manufacturer Part Number
27220
Description
BOOK STAMPWORKS
Manufacturer
Parallax Inc
Datasheet

Specifications of 27220

Accessory Type
Booklet
Product
Microcontroller Accessories
Lead Free Status / RoHS Status
Not applicable / Not applicable
For Use With/related Products
StampWorks
Lead Free Status / RoHS Status
Lead free / RoHS Compliant, Not applicable / Not applicable
Page 92 · StampWorks
Aside from the I/O reconfiguration, reading from the LCD requires the use of an
additional control line: RW. In most programs this line can be held low to allow
writing to the LCD. For reading from the LCD RAM the RW line is made high.
Using the RANDOM function this program generates an address that fits within the
CGRAM, as well a data byte to write to the LCD. The address is kept in the range of
0 to 63 by masking out the highest bits of the LOWBYTE; the HIGHBYTE is used as
the data to be written to the LCD.
The LCD’s CGRAM is normally used for custom character maps. For programs that
do not require custom characters, this area (up to 64 bytes) can be used as a
storage space by the BASIC Stamp.
In programs that require fewer than eight
custom characters the remaining bytes of CGRAM can be used as off-board memory
(subtract eight bytes from the CGRAM for each custom character definition).
Reading data from the LCD is identical to writing: the address is set and the data is
retrieved. For this to take place, the LCD data lines must be reconfigured as inputs.
Pulsing the E (enable) line makes the data (one nibble at a time) available for the
BASIC Stamp. Once again, HIGHNIB and LOWNIB are used, this time to build a
single byte from the two nibbles returned during the read operation.
When the retrieved data is ready, the address, output data and input data are
written to the LCD for examination. A short subroutine, Put_Val, handles writing
numerical values to the LCD. To use this routine, move the cursor to the desired
location, put the value to be displayed in temp, the number of characters to display
in width, and then call Put_Val. The subroutine uses the DIG operator to extract a
digit from temp and adds 48 (the ASCII code for “0”) to convert the digit value to a
character so that it can be displayed on the LCD.

Related parts for 27220