Listing 1. LCD output with the BS2p. ' -----[ Title ]----------------------------------------------------------- ' ' File...... LCDDEMO.BSP ' Purpose... BASIC Stamp 2p --> LCD ' Author.... Jon Williams ' E-mail.... jonwms@aol.com ' {$STAMP BS2p} ' -----[ Program Description ]--------------------------------------------- ' ' This program initializes the LCD in 4-bit mode and sends a simple message ' ' Connections: ' - LCD.E --> Pin0 (pulled down [to ground] through 4.7K) ' - LCD.R/W --> Pin2 (or grounded for write-only operation) ' - LCD.RS --> Pin3 ' - LCD.D4 --> Pin4 ' - LCD.D5 --> Pin5 ' - LCD.D6 --> Pin6 ' - LCD.D7 --> Pin7 ' -----[ I/O Definitions ]------------------------------------------------- ' LCDpin CON 0 ' data on pins 4 - 7 ' -----[ Constants ]------------------------------------------------------- ' ' LCD control characters ' NoCmd CON $00 ' just print ClrLCD CON $01 ' clear the LCD CrsrHm CON $02 ' cursor home CrsrLf CON $10 ' cursor left CrsrRt CON $14 ' move cursor right DispLf CON $18 ' shift display left DispRt CON $1C ' shift displayright DDRam CON $80 ' Display Data RAM control Line1 CON $80 ' address of line 1 Line2 CON $C0 ' address of line 2 ' -----[ Initialization ]-------------------------------------------------- ' LCD_Setup: 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,%00101000 : PAUSE 0 ' 2-line mode LCDCMD LCDpin,%00001100 : PAUSE 0 ' no crsr, no blink LCDCMD LCDpin,%00000110 ' inc crsr, no disp shift ' -----[ Main Code ]------------------------------------------------------- ' Main: LCDOUT LCDpin,ClrLCD,[" Parallax BS2p"] ' splash screen LCDOUT LCDpin,Line2,[" LCD Control"] END