A driver code library for Text LCD panels using the 4-bit HD44780 lcd display driver.

Dependents:   Tarea4 Tarea6 Tarea8 Tarea7 ... more

Fork of TextLCD by David Godfrey

Embed: (wiki syntax)

« Back to documentation index

TextLCD Class Reference

TextLCD Class Reference

A TextLCD interface for driving 4-bit HD44780-based LCDs. More...

#include <TextLCD.h>

Public Types

enum  LCDType {
  LCD16x2, LCD16x2B, LCD20x2, LCD20x4,
  LCD40x2
}
 

LCD panel format.

More...

Public Member Functions

 TextLCD (PinName rs, PinName e, PinName d4, PinName d5, PinName d6, PinName d7, LCDType type=LCD16x2)
 Create a TextLCD interface.
int putc (int c)
 Write a character to the LCD.
int printf (const char *format,...)
 Write a formated string to the LCD.
void writeCommand (int command)
 Locate to a screen column and row.
void cls ()
 Clear the screen and locate to 0,0.

Detailed Description

A TextLCD interface for driving 4-bit HD44780-based LCDs.

Currently supports 16x2, 20x2 , 20x4 and 40x2 panels

 #include "mbed.h"
 #include "TextLCD.h"
 
 TextLCD lcd(p10, p12, p15, p16, p29, p30, TextLCD::LCD16x2); // rs, e, d4-d7, LCDType
 
 int main() {
     lcd.printf("Hello World!\n");
 }

Definition at line 43 of file TextLCD.h.


Member Enumeration Documentation

enum LCDType

LCD panel format.

Enumerator:
LCD16x2 

16x2 LCD panel (default)

LCD16x2B 

16x2 LCD panel alternate addressing

LCD20x2 

20x2 LCD panel

LCD20x4 

20x4 LCD panel

LCD40x2 

40x2 LCD panel

Definition at line 47 of file TextLCD.h.


Constructor & Destructor Documentation

TextLCD ( PinName  rs,
PinName  e,
PinName  d4,
PinName  d5,
PinName  d6,
PinName  d7,
LCDType  type = LCD16x2 
)

Create a TextLCD interface.

Parameters:
rsInstruction/data control line
eEnable line (clock)
d4-d7Data lines for using as a 4-bit interface
typeSets the panel size/addressing mode (default = LCD16x2)

Definition at line 26 of file TextLCD.cpp.


Member Function Documentation

void cls (  )

Clear the screen and locate to 0,0.

Definition at line 56 of file TextLCD.cpp.

int printf ( const char *  format,
  ... 
)

Write a formated string to the LCD.

Parameters:
formatA printf-style format string, followed by the variables to use in formating the string.
int putc ( int  c )

Write a character to the LCD.

Parameters:
cThe character to write to the display
void writeCommand ( int  command )

Locate to a screen column and row.

Parameters:
columnThe horizontal position from the left, indexed from 0
rowThe vertical position from the top, indexed from 0

Definition at line 105 of file TextLCD.cpp.