Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
TextLCD Class Reference
A TextLCD interface for driving 4-bit HD44780-based LCDs. More...
#include <TextLCD.h>
Data Structures | |
| class | LCDType |
| LCD panel format. More... | |
Public Member Functions | |
| TextLCD (PinName rs, PinName e, PinName d4, PinName d5, PinName d6, PinName d7, const LCDType &type=LCD16x2) | |
| Create a TextLCD interface. | |
| TextLCD (PinName rs, PinName e, PortName dport, std::size_t dlsb, const 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 | locate (int column, int row) |
| 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 and 20x4 panels
#include "mbed.h" #include "TextLCD.h" TextLCD lcd(p10, p12, p15, p16, p29, p30); // rs, e, d4-d7 on individual pins TextLCD lcd(p10, p12, Port2, 2); // rs, e, d4-d7 on P2.2-P2.5 int main() { lcd.printf("Hello World!\n"); }
Definition at line 49 of file TextLCD.h.
Constructor & Destructor Documentation
| TextLCD | ( | PinName | rs, |
| PinName | e, | ||
| PinName | d4, | ||
| PinName | d5, | ||
| PinName | d6, | ||
| PinName | d7, | ||
| const LCDType & | type = LCD16x2 |
||
| ) |
Create a TextLCD interface.
- Parameters:
-
rs Instruction/data control line e Enable line (clock) d4-d7 Data lines for using as a 4-bit interface type Sets the panel size/addressing mode (default = LCD16x2)
Definition at line 47 of file TextLCD.cpp.
Create a TextLCD interface.
- Parameters:
-
rs Instruction/data control line e Enable line (clock) dport GPIO port with all data lines dlsb Index of the lowest data bit in the GPIO port type Sets the panel size/addressing mode (default = LCD16x2)
Definition at line 55 of file TextLCD.cpp.
Member Function Documentation
| void cls | ( | ) |
Clear the screen and locate to 0,0.
Definition at line 83 of file TextLCD.cpp.
| void locate | ( | int | column, |
| int | row | ||
| ) |
Locate to a screen column and row.
- Parameters:
-
column The horizontal position from the left, indexed from 0 row The vertical position from the top, indexed from 0
Definition at line 89 of file TextLCD.cpp.
| int printf | ( | const char * | format, |
| ... | |||
| ) |
Write a formated string to the LCD.
- Parameters:
-
format A 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:
-
c The character to write to the display
Generated on Thu Jul 21 2022 08:56:26 by
1.7.2