5: BASIC Stamp Command Reference – LCDOUT
BASIC Stamp Programming Manual 2.0c • www.parallaxinc.com • Page 175
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 value of the "Move To..."
command, ie: 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 CRAM.
Demo Program (LCDOUT.bsp)
' This program demonstrates initialization and printing on a 2 x 16 character LCD display.
' This is a modified version of the LCDINIT.bsp program.
'{$STAMP BS2p} 'STAMP directive (specifies a BS2p)
'-----Define LCD constants-----
WakeUp CON %00110000 'Wake-up
FourBitMode CON %00100000 'Set to 4-bit mode
TwoLine5x8Font CON %00101000 'Set to 2 display lines, 5x8 font
DisplayOff CON %00001000 'Turn off display, data is retained
DisplayOn CON %00001100 'Turn on display, no cursor
IncCrsr CON %00000110 'Auto-increment cursor, no display shift
ClearDisplay CON %00000001 'Clear the display
MoveCrsr CON %10000000 'Move cursor to position (must add address)
'-----Main Routines-----
Init:
PAUSE 1000
GOSUB InitLCD
Start:
LCDOUT 1, ClearDisplay, ["Hello my friend."]
PAUSE 1000
LCDOUT 1, MoveCrsr+64, ["How are you?"]
PAUSE 3000
LCDCMD 1, ClearDisplay
LCDOUT 1, MoveCrsr+1, ["I'm doing just"]
LCDOUT 1, MoveCrsr+70, ["fine!"]
PAUSE 3000
GOTO Start
'-----Subroutines-----
InitLCD:
LCDCMD 1, WakeUp 'Send wakeup sequence to LCD
PAUSE 10 'These pauses are necessary to meet the LCD specs
LCDCMD 1, WakeUp
PAUSE 1
2