Version 2.0 of TextLCD_SB1602E. The old class driver has been rewritten in more common manner of I2C devices.

Dependents:   SB1602E_Hello BME280_LCD PreHeater PreHeater ... more

Embed: (wiki syntax)

« Back to documentation index

SB1602E Class Reference

SB1602E Class Reference

SB1602E class. More...

#include <SB1602E.h>

Public Member Functions

 SB1602E (PinName I2C_sda, PinName I2C_scl, char *init_massage=NULL)
 Create a SB1602E instance which is connected to specified I2C pins with specified address.
 SB1602E (I2C &i2c_, char *init_massage=NULL)
 Create a PCA9629A instance connected to specified I2C pins with specified address.
 ~SB1602E ()
 Destractor.
void printf (char line, char *format,...)
 Printf.
void printf (char x, char y, char *format,...)
 Printf.
void putc (char line, char c)
 Put character : "putc()".
void puts (char line, char *s)
 Put string : "puts()".
void putcxy (char c, char x, char y)
 Put character into specified screen position.
void clear (void)
 Clear the LCD.
void contrast (char contrast)
 Contrast adjustment.
void put_custom_char (char c_code, const char *cg, char x, char y)
 Put a custom character given as bitmap data.
void set_CGRAM (char char_code, const char *cg)
 Set CGRAM (set custom bitmap as a character)
void set_CGRAM (char char_code, char v)
 Set CGRAM (set custom bitmap as a character)
void puticon (unsigned short flg)
 Icon operation (for SB1602B)
void setCharsInLine (char ch)
 Set number of charactors in a line.

Detailed Description

SB1602E class.

This is a driver code for the SB1602E LCD module. This class provides interface for ST7032 operation and accessing its registers.

Example:

  #include "mbed.h"
  #include "SB1602E.h"
  
  SB1602E lcd(  p9, p10 );  //  SDA, SCL
  
  int main() {
      lcd.printf( 0, "Hello world!" );    //  line# (0 or 1), string
      lcd.printf( 1, "pi = %.6f", 3.14159265 );
  }

Definition at line 54 of file SB1602E.h.


Constructor & Destructor Documentation

SB1602E ( PinName  I2C_sda,
PinName  I2C_scl,
char *  init_massage = NULL 
)

Create a SB1602E instance which is connected to specified I2C pins with specified address.

Text LCD module "SB1602E" class library.

Parameters:
I2C_sdaI2C-bus SDA pin
I2C_sclI2C-bus SCL pin
init_massagestring to initialize the LCD
Author:
Tedd OKANO, Masato YAMANISHI & Toyomasa Watarai
Version:
2.1
Date:
07-April-2015

SB1602E is an I2C based low voltage text LCD panel (based Sitronix ST7032 chip) The module by StrawberryLinux http://strawberry-linux.com/catalog/items?code=27002 (Online shop page (Japanese)) http://strawberry-linux.com/pub/ST7032i.pdf (datasheet of the chip)

This is a library to operate this module easy.

Released under the Apache 2 license License

revision history (class lib name was "TextLCD_SB1602E") revision 1.0 22-Jan-2010 a. 1st release revision 1.1 23-Jan-2010 a. class name has been changed from lcd_SB1602E to TextLCD_SB1602E b. printf() added c. copyright notice added revision 1.3 02-May-2014 a. puticon() added (for SB1602B) by Masato YAMANISHI san revision 2.0 20-Oct-2014 a. class name is changed and published as "SB1602E" b. re-written for better usability revision 2.1 07-Apl-2015 a. add printf() with X and Y position b. add setter for number of chars in a line (e.g. 8x2 LCD support)

Definition at line 33 of file SB1602E.cpp.

SB1602E ( I2C &  i2c_,
char *  init_massage = NULL 
)

Create a PCA9629A instance connected to specified I2C pins with specified address.

Parameters:
I2Cobject (instance)
init_massagestring to initialize the LCD

Definition at line 38 of file SB1602E.cpp.

~SB1602E (  )

Destractor.

Definition at line 43 of file SB1602E.cpp.


Member Function Documentation

void clear ( void   )

Clear the LCD.

Definition at line 150 of file SB1602E.cpp.

void contrast ( char  contrast )

Contrast adjustment.

Parameters:
contrastvalue (from 0x00 to 0x3E)

Definition at line 158 of file SB1602E.cpp.

void printf ( char  x,
char  y,
char *  format,
  ... 
)

Printf.

printf function with X and Y character position on the LCD. it can be used like

lcd.printf( 0, 0, "Hello world!" ); lcd.printf( 4, 1, "pi = %.6f", 3.14159265 );

Parameters:
xX horizontal character position on the LCD
yY vertical character position on the LCD
formatfollowing parameters are compatible to stdout's printf

Definition at line 108 of file SB1602E.cpp.

void printf ( char  line,
char *  format,
  ... 
)

Printf.

printf function with line number. it can be used like

lcd.printf( 0, "Hello world!" ); lcd.printf( 1, "pi = %.6f", 3.14159265 );

Parameters:
lineline# (0 for upper, 1 for lower)
formatfollowing parameters are compatible to stdout's printf

Definition at line 96 of file SB1602E.cpp.

void put_custom_char ( char  c_code,
const char *  cg,
char  x,
char  y 
)

Put a custom character given as bitmap data.

Parameters:
c_codecharacter code
cgpointer to bitmap data (array of 8 bytes)
xhorizontal character position on the LCD
yvertical character position on the LCD

Definition at line 166 of file SB1602E.cpp.

void putc ( char  line,
char  c 
)

Put character : "putc()".

Parameters:
lineline# (0 for upper, 1 for lower)
ccharacter code

Definition at line 121 of file SB1602E.cpp.

void putcxy ( char  c,
char  x,
char  y 
)

Put character into specified screen position.

Parameters:
ccharacter code
xhorizontal character position on the LCD
yvertical character position on the LCD

Definition at line 138 of file SB1602E.cpp.

void puticon ( unsigned short  flg )

Icon operation (for SB1602B)

Parameters:
flgbitpattern to choose ICON

Definition at line 243 of file SB1602E.cpp.

void puts ( char  line,
char *  s 
)

Put string : "puts()".

Parameters:
lineline# (0 for upper, 1 for lower)
spointer to a string data

Definition at line 132 of file SB1602E.cpp.

void set_CGRAM ( char  char_code,
char  v 
)

Set CGRAM (set custom bitmap as a character)

Parameters:
c_codecharacter code
vbitmap data (5 bit pattern in this variable are copied to all row of a character bitmap)

Definition at line 182 of file SB1602E.cpp.

void set_CGRAM ( char  char_code,
const char *  cg 
)

Set CGRAM (set custom bitmap as a character)

Parameters:
c_codecharacter code
cgpointer to bitmap data (array of 8 bytes)

Definition at line 174 of file SB1602E.cpp.

void setCharsInLine ( char  ch )

Set number of charactors in a line.

Parameters:
chnumber of charactors in a line

Definition at line 169 of file SB1602E.h.