External Links

Creative Science Centre

 

lib_lcdi2c

This library is for the COG type displays with the ST7032 controller.

See here for the conventional LCD library

16x2 LCD 3.3v Character COG Display Module,,Black on White

Typical type with separate back light pins. The controller behaves in a similar way to the standard HD44780 controller except that it works through an I2C interface/

  • Data sheet for the ST7032 controller

// #include "http://www.byvac.com/mBlib/flb/Library/2016/lib_lcdi2c.bas"

Apart from the I2C, there is the back light and reset pins and these are set up in init.

Wiring

  • Pin 1 connect to the reset pin
  • Pin 2 V+
  • Pin 3 GND
  • Pin 4 SCL
  • Pin 5 SDA
  • Pin 6 GND
  • Pin 7 V+
  • Pin 8 1uF to ground
  • Pin 9 V+
  • Pin 10 GND
  • Pin 11 and 12 1uF

Functions

Example of constants if back light is on RB0 and reset is on RB1

constant     BL   {PORTB(PORT),0}
constant     RST {PORTB(PORT),1}
 

  • lcd.init(*RST(),*BL()) // specify the back light and reset pin see constant examples above
  • lcd.mode(m) // m=0 is normal 16x2, m=1 gives 16x1 double height
  • lcd.cur(v) v = 7 for full height flashing, 6 = underline steady
  • lcd.cls() // blanks screen
  • lcd.contrast(v) normal for 3v3 is about 50, normal for 5V is about 20
  • lcd.rc(row,col)
  • lcd.putc(c) // single character
  • lcd.puts(s$) // string