LCDIN - BASIC Stamp Command Reference
Page 170 • BASIC Stamp Programming Manual 2.0b • www.parallaxinc.com
Special Formatter Action
STR ByteArray \L {\E}
Input a character string of length L into an array. If specified, an
end character E
causes the string input to end before reaching
length L. Remaining bytes are filled with 0s (zeros).
WAITSTR ByteArray {\L}
Wait for a sequence of bytes matching a string stored in an array
variable, optionally limited to L characters.
If the optional L
argument is left off, the end of the array
-string must be marked
by a byte containing a zero (0).
SKIP Length
Length bytes of characters.
Demo Program (LCDIN.bsp)
' This program demonstrates initialization, printing and reading from a 2 x 16 character
' LCD display.
'{$STAMP BS2p} 'STAMP directive (specifies a BS2p)
Char VAR BYTE(16) 'Variable for holding text read from LCD
Init:
LCDCMD 1,48 'Send wakeup sequence to LCD
PAUSE 10 'These pauses are necessary to meet the LCD specs
LCDCMD 1,48
PAUSE 1
LCDCMD 1,48
PAUSE 1
LCDCMD 1,32 'Set buss to 4-bit mode
LCDCMD 1,40 'Set to 2-line mode with 5x8 font
LCDCMD 1,8 'Turn display off
LCDCMD 1,12 'Turn display on with blinking cursor
LCDCMD 1,6 'Set to auto-increment cursor (no display shift)
Start:
LCDOUT 1,1,["Hello!"]
GOSUB ReadLCDScreen
PAUSE 3000
LCDOUT 1,1,["I'm a 2x16 LCD!"]
GOSUB ReadLCDScreen
PAUSE 3000
GOTO Start
ReadLCDScreen:
DEBUG "LCD Now Says: "
LCDIN 1,128,[STR Char\16]
DEBUG STR Char\16,CR,CR
RETURN
Table 5.31: LCDIN Special
Formatters.
2