You are viewing an older revision! See the latest version
Text LCD
A driver for Text LCD panels using the 4-bit HD4478 driver.
Hello World!¶
Hello World code for driving a 16x2 LCD panel:
#include "mbed.h" #include "TextLCD.h" TextLCD lcd(p10, p12, p15, p16, p29, p30); // rs, e, d0-d3 int main() { lcd.printf("Hello World!\n"); }
Text LCD Library¶
// Constructor // rs, e, d0-d3: DigitalOut pins for Instruction/data control line, Enable line (clock), Data lines // type: Sets the panel size/addressing mode TextLCD(PinName rs, PinName e, PinName d0, PinName d1, PinName d2, PinName d3, LCDType type = LCD16x2); // Control methods int putc(int c); int printf(const char* format, ...); void locate(int column, int row); void cls();
Different LCD Panel Sizes¶
Setting the type field int the TextLCD constructor allows configuration for the different display panel sizes:
TextLCD::LCD16x2 16x2 LCD panel (default) TextLCD::LCD16x2B 16x2 LCD panel alternate addressing TextLCD::LCD20x2 20x2 LCD panel TextLCD::LCD20x4 20x4 LCD panel
Reference¶
- Some of the original details were found at http://www.a-netz.de/lcd.en.php
- http://mbed.org/forum/mbed/topic/195/ covered lots of our discovery