Connecting the LCD02 to the BS2p using the I2C Bus

Introduction
This example shows how to connect the LCD02 module to the Basic Stamp BS2p. The
LCD02 is used in I2C mode. I2C mode is selected by removing the link on the
2 pin header on the LCD02 module. The BS2 internal 5v regulator is not suitable for
powering the LCD02. I therefore recommend you use a separate 5v regulator. The LED
backlight on the LCD02 requires around 270mA.
Circuit Schematic for connecting the BS2p Stamp to the LCD02 Display Module
Software for BS2p
The following code is for the BS2p and can be downloaded here
'{$STAMP BS2p}
'*********************************************************** '** ** '** I2C Routines for the Basic Stamp BS2p ** '** Controlling LCD02 I2C LCD Display ** '** ** '** Copyright 2004 - Devantech Ltd ** '** Commercial use of this software is prohibited ** '** Private and educational use only is permitted ** '** ** '** Written by Gerald Coe - April 2004 ** '** ** '*********************************************************** Key1 VAR Byte Key2 VAR Byte SCL CON 9 ' I2C clock SDA CON 8 ' I2C data CLRSCRN CON 12 ' Clear Screen CUROFF CON 4 ' Hide Cursor SETCUR CON 2 ' set cursor position Main: PAUSE 500 ' Wait for the display to go through its power up routine I2COUT SDA, $c6, 0, [CLRSCRN, CUROFF, " LCD02 - BS2p I2C Demonstration "] MainLoop: I2CIN SDA, $c6, 1, [Key1, Key2] I2COUT SDA, $c6, 0, [SETCUR, 60," Keypad ", BIN4 key2, BIN8 key1] GOTO MainLoop ' Loop forever |
You can find LCD02 Documentation Here