
LCDOUT - BASIC Stamp Command Reference
Page 174
•
BASIC Stamp Programming Manual 2.0b
•
www.parallaxinc.com
Another use for the LCDOUT command is to access and create custom
characters. The Hitachi 44780 controller has a built-in character set that is
similar to the ASCII character set (at least for the first 128 characters).
Most of these characters are stored in ROM and are not changeable,
however, the first eight characters (ASCII 0 though 7) are programmable.
Each of the programmable characters is five pixels wide and eight pixels
tall. It takes eight bytes to describe each character; one byte per row (the
left-most three bits are ignored). For example, the character at ASCII
location 0 is defined by the bit patterns stored in bytes 0 through 7 of
Character RAM (CRAM). The character at ASCII location 1 is defined by
the bit patterns stored in bytes 8 through 15 of CRAM, and so on.
To create a custom character, use some graph paper to plot out the bit
pattern (on and off pixels) in a 5 x 8 pattern, as shown in Figure 5.14. Then
calculate the corresponding binary value of the bit pattern for each of the
eight rows of character data.
After the data is calculated for each character (8 byte values per character),
use the LCDOUT command with the "Move To CRAM Address"
instruction to insert the data into the character's CRAM locations. For
example, the code below will store the character shown in Figure 5.14 into
character 0's CRAM data locations. Then it will place the cursor back on
the display (DRAM) and print the character on the screen.
LCDOUT 1, 64+0, [00, 10, 00, 04, 17, 14, 00, 00]
LCDOUT 1, 128+0, ["Custom Char: ", 0]
The number 64 in the Command argument is the LCD's "Move to CRAM
Address" instruction and the 0 that is added to it is the location of the first
4
3
2
1
0
Byte 0:
Character Cell Structure and Data
Byte 1:
Byte 2:
Byte 3:
Byte 4:
Byte 5:
Byte 6:
Byte 7:
---------Bits---------
xxx00000
xxx01010
xxx00000
xxx00100
xxx10001
xxx01110
xxx00000
xxx00000
Binary Values
00
10
00
04
17
14
00
00
Decimal Values
Figure 5.14: LCD Character
Structure.
C
REATING CUSTOM CHARACTERS
.
Summary of Contents for BASIC Stamp 2e
Page 1: ...BASIC Stamp Programming Manual Version 2 0c...
Page 34: ...Quick Start Guide Page 32 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Page 340: ...ASCII Chart Page 338 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Page 342: ...Reserved Words Page 340 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Page 346: ...Conversion Formatters Page 344 BASIC Stamp Programming Manual 2 0b www parallaxinc com...