Parallax, Inc. • BS2p “Plus Pack” (#45184) • 10/2001
Page 3
display VAR cmd.Bit2 ' display on/off bit
cursor VAR cmd.Bit1 ' cursor on/off bit
blinking VAR cmd.Bit0 ' blinking on/off bit
char VAR cmd ' character sent to LCD
idx VAR Byte ' loop counter
' -----[ EEPROM Data ]----------------------------------------------------------
'
' -----[ Initialization ]-------------------------------------------------------
'
Initialize:
PAUSE 500 ' let the LCD settle
LCDCMD LCDpin,%00110000 : PAUSE 5 ' 8 -bit mode
LCDCMD LCDpin,%00110000 : PAUSE 0
LCDCMD LCDpin,%00110000 : PAUSE 0
LCDCMD LCDpin,%00100000 : PAUSE 0 ' 4 -bit mode
LCDCMD LCDpin,%00001100 : PAUSE 0 ' no crsr, no blink
LCDCMD LCDpin,%00000110 ' inc crsr, no disp shift
' -----[ Main Code ]------------------------------------------------------------
'
Main:
LCDCMD LCDpin,ClrLCD ' clear display
PAUSE 500
Splash_Screen
LCDOUT LCDpin,NoCmd,["THE BASIC STAMP!"]
PAUSE 2000
Cursor_On:
LCDCMD LCDpin,CrsrHm ' move the cursor home
cmd = DispCtrl
display = On
cursor = On
LCDCMD LCDpin,cmd
PAUSE 500
Move_Cursor:
FOR idx = 1 TO 15 ' move the cursor across display
LCDCMD LCDpin,CrsrRt
PAUSE 150
NEXT
FOR idx = 14 TO 0 ' go backward by moving cursor
cmd = DDRam + idx ' to a specific address
LCDCMD LCDpin,cmd
PAUSE 150
NEXT
PAUSE 1000
Block_Cursor:
cmd = DispCtrl
display = On
blinking = On ' enable block cursor
LCDCMD LCDpin,cmd
PAUSE 2000
blinking = Off ' turn it off