Parallax BASIC Stamp 2e Programming Manual page 176

Table of Contents

Advertisement

LCDOUT - BASIC Stamp Command Reference
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.
Character Cell Structure and Data
Byte 0:
Byte 1:
Byte 2:
Byte 3:
Byte 4:
Byte 5:
Byte 6:
Byte 7:
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
Page 174 • BASIC Stamp Programming Manual 2.0b • www.parallaxinc.com
---------Bits---------
4
3
2
1
0
Binary Values
xxx00000
xxx01010
xxx00000
xxx00100
xxx10001
xxx01110
xxx00000
xxx00000
Decimal Values
00
10
00
04
17
14
00
00
C
REATING CUSTOM CHARACTERS
Figure 5.14: LCD Character
Structure.
.

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the BASIC Stamp 2e and is the answer not in the manual?

Subscribe to Our Youtube Channel

Table of Contents