EasyManua.ls Logo

Parallax BASIC Stamp 2e - Page 167

Default Icon
353 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
5: BASIC Stamp Command Reference LCDCMD
BASIC Stamp Programming Manual 2.0c www.parallaxinc.com Page 165
Demo Program (LCDINIT.bsp)
' This program demonstrates initialization and printing on a 2 x 16 character LCD display.
' The set of "LCD constants", below, are provided as pre-defined and useful LCD commands,
' though only a few are actually used in this program.
'{$STAMP BS2p} 'STAMP directive (specifies a BS2p)
'-----Define LCD constants-----
WakeUp CON %00110000 'Wake-up
FourBitMode CON %00100000 'Set to 4-bit mode
OneLine5x8Font CON %00100000 'Set to 1 display line, 5x8 font
OneLine5x10Font CON %00100100 'Set to 1 display line, 5x10 font
TwoLine5x8Font CON %00101000 'Set to 2 display lines, 5x8 font
TwoLine5x10Font CON %00101100 'Set to 2 display lines, 5x10 font
DisplayOff CON %00001000 'Turn off display, data is retained
DisplayOn CON %00001100 'Turn on display, no cursor
DisplayOnULCrsr CON %00001110 'Turn on display, with underline cursor
DisplayOnBLCrsr CON %00001101 'Turn on display, with blinking cursor
IncCrsr CON %00000110 'Auto-increment cursor, no display shift
IncCrsrShift CON %00000111 'Auto-increment cursor, shift display left
DecCrsr CON %00000100 'Auto-decrement cursor, no display shift
DecCrsrShift CON %00000101 'Auto-decrement cursor, shift display right
ClearDisplay CON %00000001 'Clear the display
HomeDisplay CON %00000010 'Move cursor and display to home position
ScrollLeft CON %00011000 'Scroll display to the left
ScrollRight CON %00011100 'Scroll display to the right
CrsrLeft CON %00010000 'Move cursor left
CrsrRight CON %00010100 'Move cursor right
MoveCrsr CON %10000000 'Move cursor to position (must add address)
MoveToCGRAM CON %01000000 'Move to CGRAM position (must add address)
'-----Main Routines-----
Init:
PAUSE 1000
GOSUB InitLCD
Start:
LCDOUT 1, ClearDisplay, ["Hello World!"]
LCDOUT 1, MoveCrsr+64, ["How are you?"]
STOP
'-----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
LCDCMD 1, WakeUp
PAUSE 1
p
2

Table of Contents

Related product manuals