BASIC stamp manual v2.2
5: BASIC Stamp Command Reference – LCDOUT
BASIC Stamp Syntax and Reference Manual 2.2 • www.parallax.com • Page 267
character 0's CGRAM data locations. Then it will place the cursor back on
the display (DDRAM) and print the character on the screen.
LCDOUT 0, 64+0, [00, 10, 00, 04, 17, 14, 00, 00]
LCDOUT 0, 128+0, ["Custom Char: ", 0]
The number 64 in the Command argument is the LCD's "Move to CGRAM
Address" instruction and the 0 that is added to it is the location of the first
row of data for the character 0. The LCDOUT command will write the
first OutputData value (00) to this location, the second OutputData value
(10) to location 1, etc. If we wanted this custom character to affect
character 1, instead of 0, we'd have to adjust the value of the "Move To..."
command, i.e.: 64+8. To affect character 2, we'd use 64+16.
To try the example above, don't forget to execute the LCD initialization
code (shown in the LCDCMD description) first and never forget to move
the cursor back to the screen (as with the last command, above) when
you're done writing the character data to CGRAM.
Demo Program (LCDOUT.bsp)
' LCDOUT.bsp
' This program demonstrates initialization and printing on a 2x16
' character LCD display.
' {$STAMP BS2p}
' {$PBASIC 2.5}
#IF ($STAMP < BS2P) #THEN
#ERROR "Program requires BS2p, BS2pe or BS2px."
#ENDIF
Lcd PIN 0
LcdCls CON $01 ' clear the LCD
LcdHome CON $02 ' move cursor home
LcdCrsrL CON $10 ' move cursor left
LcdCrsrR CON $14 ' move cursor right
LcdDispL CON $18 ' shift chars left
LcdDispR CON $1C ' shift chars right
LcdDDRam CON $80 ' Display Data RAM
LcdCGRam CON $40 ' Character Generator RAM
LcdLine1 CON $80 ' DDRAM address of line 1
LcdLine2 CON $C0 ' DDRAM address of line 2
Init_LCD:
PAUSE 1000 ' allow LCD to self-initialize first
NOTE: This example program can be
used with the BS2p, BS2pe, and
BS2px. This program uses conditional
compilation techniques; see Chapter 3
for more information.