Rob Keij / LCD_4x20_MCC0G42005A6W
Embed: (wiki syntax)

« Back to documentation index

LCD_COG Class Reference

LCD_COG Class Reference

LCD example. More...

#include <MCC0G42005A6W.h>

Public Member Functions

 LCD_COG (PinName I2C_sda, PinName I2C_scl, const char *init_message=NULL)
 Create a LCD instance which is connected to specified I2C pins with specified address.
 LCD_COG (I2C &i2c_, const char *init_message=NULL)
 Create a LCD instance connected to specified I2C pins with specified address.
 ~LCD_COG ()
 Destructor.
void printf (char line, const char *format,...)
 Printf.
void printf (char x, unsigned char y, const char *format,...)
 Printf.
void putc (unsigned char line, char c)
 Put character : "putc()".
void puts (char line, const char *s)
 Put string : "puts()".
void putcxy (char c, unsigned char x, unsigned 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 setCharsInLine (char ch)
 Set number of characters in a line.

Detailed Description

LCD example.

 #include    <stdarg.h>
 #include    "mbed.h"
 #include    "MCC0G42005A6W.h"

 // MCCOG42005A6W-BNMLWI
 // Alphanumeric LCD, 20 x 4, White on Blue, 3V to 5V, I2C, English, Japanese, Transmissive
 // Farnell nr. 2218946
 // example PCB  LCD I2C 4x20 https://circuitmaker.com/User/Details/Rob-Keij-4

  LCD_COG lcd(SDA, SCL, "==LCD=Driver=V1.00==");  //  SDA, SCL

 int main()
 {
  lcd.printf( 0, 0, "Hello world!" );
  lcd.printf( 4, 1, "pi = %.6f", 3.14159265 );
  lcd.printf( 2, 2, "This is Row %d",2 );
  lcd.printf( 3, 3, "This is Row %d",3 );

    while(1) {

    }
 }

Definition at line 38 of file MCC0G42005A6W.h.


Constructor & Destructor Documentation

LCD_COG ( PinName  I2C_sda,
PinName  I2C_scl,
const char *  init_message = NULL 
)

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

Parameters:
I2C_sdaI2C-bus SDA pin
I2C_sclI2C-bus SCL pin
init_messagestring to initialize the LCD

Definition at line 10 of file MCC0G42005A6W.cpp.

LCD_COG ( I2C &  i2c_,
const char *  init_message = NULL 
)

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

Parameters:
I2Cobject (instance)
init_messagestring to initialize the LCD

Definition at line 17 of file MCC0G42005A6W.cpp.

~LCD_COG (  )

Destructor.

Definition at line 23 of file MCC0G42005A6W.cpp.


Member Function Documentation

void clear ( void   )

Clear the LCD.

Definition at line 143 of file MCC0G42005A6W.cpp.

void contrast ( char  contrast )

Contrast adjustment.

Parameters:
contrastvalue (from 0x00 to 0x3E)

Definition at line 154 of file MCC0G42005A6W.cpp.

void printf ( char  x,
unsigned char  y,
const 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 ); lcd.printf( 2, 2, "This is Row %d",2 ); lcd.printf( 3, 3, "This is Row %d",3 );

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 94 of file MCC0G42005A6W.cpp.

void printf ( char  line,
const 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 ); lcd.printf( 2, "This is Row %d",2 ); lcd.printf( 3, "This is Row %d",3 );

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

Definition at line 79 of file MCC0G42005A6W.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 164 of file MCC0G42005A6W.cpp.

void putc ( unsigned char  line,
char  c 
)

Put character : "putc()".

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

Definition at line 108 of file MCC0G42005A6W.cpp.

void putcxy ( char  c,
unsigned char  x,
unsigned 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 129 of file MCC0G42005A6W.cpp.

void puts ( char  line,
const char *  s 
)

Put string : "puts()".

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

Definition at line 121 of file MCC0G42005A6W.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 184 of file MCC0G42005A6W.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 MCC0G42005A6W.cpp.

void setCharsInLine ( char  ch )

Set number of characters in a line.

Parameters:
chnumber of charactors in a line

Definition at line 152 of file MCC0G42005A6W.h.