E CON 0 ' LCD Enable pin (1 = enabled) RS CON 3 ' Register Select (1 = char) LCDout VAR OutH ' 8-bit LCD data 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 char VAR Byte ' character sent to LCD index VAR Byte ' loop counter ' ------------------------------------------------------------------------- Msg DATA "THE BASIC STAMP!",0 ' preload EEPROM with message ' ------------------------------------------------------------------------- Initialize: DirL = %11111111 ' setup pins for LCD DirH = %11111111 char = %00001100 ' display on GOSUB LCDcommand char = %00111000 ' function set GOSUB LCDcommand ' ------------------------------------------------------------------------- Main: char = ClrLCD ' clear the LCD GOSUB LCDcommand PAUSE 500 char = "H" GOSUB LCDwrite PAUSE 500 char = "I" GOSUB LCDwrite END LCDcommand: LOW RS ' enter command mode LCDwrite: LCDout = char ' output byte PULSOUT E,1 ' strobe the Enable line HIGH RS ' return to character mode RETURN index = Msg ' get EE address of message ReadChar: READ index,char ' get character from EEPROM IF char = 0 THEN MsgDone ' if 0, message is complete GOSUB LCDwrite ' write the character index = index + 1 ' point to next character GOTO ReadChar ' go get it MsgDone: ' the message is complete PAUSE 2000 ' wait 2 seconds