STAMP Serial LCD
This is a short description of how to interface to an LCD module that
you can buy from Scott Edwards
Electronics. The LCD modules available from him are self-contained
and only require 3 lines to work: 5V power, ground and a serial input
line! It couldn't be any easier.
The screen sizes are either 2 or 4 lines; I bought a 2 line module. It
is very handy for debugging projects on the fly where you need to
continually monitor a value, but don't want the expense of sending
debug messages to your PC. However, you will note a small slowdown of
your code as the Stamp sends data to the LCD module.
The LCD receives commands over the serial line that you send using the
SEROUT command. The LCD runs at either 9600 baud or 2400 baud. If you
are using a Stamp 1 then you will be limited to 2400 baud
communication. The Stamp2 will communicate at 9600 baud with the
LCD. I recommend this as the slower baud rates will slow down the
execution of your code.
Sample code to send data to a LCD
Here is some Basic 2 code to send data to the LCD module. You notice
that I use lots of constant definitions to encode commands to the
If you want to send data at 9600 baud to the LCD module, replace the
N24N con 16780
N96N con 16468
Whereever I use N24N in the code, you replace that with N96N and don't
forget to set your LCD module to 9600 baud!
Click here to download the PBASIC code.
' Send "hello world" to a Serial LCD connected to
' P9 (pin 14) of a STAMP II
' Mark Crosbie 1998 firstname.lastname@example.org
LCDPREFIX con 254
LCDCLS con 1
LCDHOME con 2
LCDBLANK con 8
LCDSCRLLEFT con 24
LCDSCRLRT con 28
N24N con 16780
dir9 = 1
serout 9,N24N,[LCDPREFIX, LCDCLS]
serout 9,N24N,[" THERE"]
for b1 = 1 to 10
serout 9,N24N,[LCDPREFIX, LCDSCRLLEFT]
Ok, what does it do? It prints Hello THERE on the LCD screen and then
scrolls it left ten times. Silly, but it illustrates the point. The
commands to clear the screen (LCDCLS) and scroll the screen
(LCDSCRLLEFT) are constants obtained from the manual that came with
the LCD backpack.