Hi,
This is the Basic Stamp 2 sample you can find in your LCD manual.
Changes for PBP:
- SEROUT Pin,Mode,[Item{,Item...}]
Mode is 6 (9600 Driven Inverted)
- Declare variable b2
b2 VAR byte
Serial LCD manual:
http://www.seetron.com/pdf/bpp423.pdf
In order to run the sample code below you will have to set the
DIP Switch of the LCD module as following:
1=OFF (Normal mode)
2=ON (9600 baud)
Regards,
Luciano
Code:
' Program: 420DEMO.BS2 (Demonstrate 4x20 Serial LCD with Stamp II)
' This program demonstrates many of the features of the 4x20 Serial
' LCD Module from Scott Edwards Electronics. Set the module to
' 9600 bps (S1: switch 1 down; 2 up). Connect the serial input
' of the module to BS2 pin P0, GND to GND and +5V to +5V.
' Run this program.
' =========Define names for LCD instructions, bps=======
noCurs con 4 ' Make cursor invisible.
ulCurs con 5 ' Show underline cursor.
clrLCD con 12 ' Clear entire LCD screen.
posCmd con 16 ' Position cursor.
clrCol con 17 ' Clear column.
wedge con 128 ' Wedge-shaped symbol.
bigNums con 2 ' Begin big numbers.
N9600 con $4054 ' Baudmode for inverted, 9600-bps output.
' The constants "bell" and "bksp" are predefined in PBASIC2.
' =================Begin demonstration=================
pause 1000
serout 0,N9600,[clrLCD] ' Clear the screen.
for b2 = 0 to 79
serout 0,N9600,[wedge] ' Fill screen with wedges.
next
pause 1000 ' Wait 1 second.
serout 0,N9600,[posCmd,68] ' Move to position 4 (64+4= 68).
for b2 = 1 to 12 ' Clear a 12-character swath with
pause 350 ' ...the clear-column feature.
serout 0,N9600,[clrCol,bell] ' Ring bell (if available) each loop.
next
' Turn on the underline cursor, move to pos. 26, and show message.
serout 0,N9600,[ulCurs,posCmd,90,"4x20 LCD"]
pause 1000 ' Wait 1 second.
for b2 = 1 to 8
pause 100 ' Backspace to erase message.
serout 0,N9600,[bksp,bell] ' Ring bell (if available) each loop.
next
pause 1000 ' Wait 1 second.
serout 0,N9600,[noCurs] ' Turn cursor off.
' Print the numbers 0 to 99 in big numbers in the middle of
' the screen. Pause a half second between numbers.
for b2 = 0 to 99
serout 0,N9600,[posCmd,70,bigNums,dec b2]
pause 500
next
END ' Finished.
Bookmarks