Parallax, Inc. • BS2p “Plus Pack” (#45184) • 10/2001
Page 16
' -----[ I/O Definitions ] ------------------------------------------------------
'
LCDpin CON 0 ' LCD is connected to OutL
AskBtn VAR In15 ' Ask button input pin
' -----[ Constants ]------------------------------------------------------------
'
NoCmd CON $00 ' No command in LCDOUT
ClrLCD CON $01 ' clear the LCD
CrsrHm CON $02 ' move cursor to home position
CrsrLf CON $10 ' move cursor left
CrsrRt CON $14 ' move cursor right
DispLf CON $18 ' shift displayed chars left
DispRt CON $1C ' shift displayed chars right
DDRam CON $80 ' Display Data RAM control
NumAns CON 6 ' 6 possible answers
_g CON $E7 ' DDROM addresses of descenders
_j CON $EA
_p CON $F0
_q CON $F1
_y CON $F9
Pressed CON 0 ' button input is active low
' -----[ Variables ]------------------------------------------------------------
'
char VAR Byte ' character sent to LCD
addr VAR Byte ' message address
answer VAR Nib ' answer pointer
clock VAR Nib ' animation clock
pntr VAR Nib ' pointer to animation character
' -----[ EEPROM Data ]----------------------------------------------------------
'
Prompt DATA "Ask a question",0 ' messages for LCD
Ans0 DATA "Definitely YES",0
Ans1 DATA "Possible...",0
Ans2 DATA "Definitely NO",0
Ans3 DATA "Not likely...",0
Ans4 DATA "Answer uncertain",0
Ans5 DATA "Please ask again",0
' -----[ 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,%00100100 : PAUSE 0 ' 5x10 font
LCDCMD LCDpin,%00001100 : PAUSE 0 ' no crsr, no blink
LCDCMD LCDpin,%00000110 ' inc crsr, no disp shift