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.h
00001 /* mbed TextLCD Library 00002 * Copyright (c) 2007-2009 sford 00003 * Released under the MIT License: http://mbed.org/license/mit 00004 * 00005 * TODO: Needs serious rework/neatening up! 00006 */ 00007 00008 #ifndef MBED_TEXTLCD_H 00009 #define MBED_TEXTLCD_H 00010 00011 #include "Stream.h" 00012 #include "DigitalOut.h" 00013 #include "BusOut.h" 00014 00015 namespace mbed { 00016 00017 /* Class: TextLCD 00018 * A 16x2 Text LCD controller 00019 * 00020 * Allows you to print to a Text LCD screen, and locate/cls. Could be 00021 * turned in to a more generic libray. 00022 * 00023 * If you are connecting multiple displays, you can connect them all in 00024 * parallel except for the enable (e) pin, which must be unique for each 00025 * display. 00026 * 00027 * Example: 00028 * > #include "mbed.h" 00029 * > #include "TextLCD.h" 00030 * > 00031 * > TextLCD lcd(p24, p25, p26, p27, p28, p29, p30); // rs, rw, e, d0, d1, d2, d3 00032 * > 00033 * > int main() { 00034 * > lcd.printf("Hello World!"); 00035 * > } 00036 */ 00037 class TextLCD : public Stream { 00038 00039 public: 00040 /* Constructor: TextLCD 00041 * Create a TextLCD object, connected to the specified pins 00042 * 00043 * All signals must be connected to DigitalIn compatible pins. 00044 * 00045 * Variables: 00046 * rs - Used to specify data or command 00047 * rw - Used to determine read or write 00048 * e - enable 00049 * d0..d3 - The data lines 00050 */ 00051 TextLCD(PinName rs, PinName rw, PinName e, PinName d0, PinName d1, 00052 PinName d2, PinName d3, int columns = 16, int rows = 2); 00053 00054 #if 0 // Inhereted from Stream, for documentation only 00055 /* Function: putc 00056 * Write a character 00057 * 00058 * Variables: 00059 * c - The character to write to the serial port 00060 */ 00061 int putc(int c); 00062 00063 /* Function: printf 00064 * Write a formated string 00065 * 00066 * Variables: 00067 * format - A printf-style format string, followed by the 00068 * variables to use in formating the string. 00069 */ 00070 int printf(const char* format, ...); 00071 #endif 00072 00073 /* Function: locate 00074 * Locate to a certian position 00075 * 00076 * Variables: 00077 * column - the column to locate to, from 0..15 00078 * row - the row to locate to, from 0..1 00079 */ 00080 virtual void locate(int column, int row); 00081 00082 /* Function: cls 00083 * Clear the screen, and locate to 0,0 00084 */ 00085 virtual void cls(); 00086 00087 virtual void reset(); 00088 00089 //protected: 00090 00091 void clock(); 00092 void writeData(int data); 00093 void writeCommand(int command); 00094 void writeByte(int value); 00095 void writeNibble(int value); 00096 virtual int _putc(int c); 00097 virtual int _getc(); 00098 virtual void newline(); 00099 00100 int _row; 00101 int _column; 00102 DigitalOut _rw, _rs, _e; 00103 BusOut _d; 00104 int _columns; 00105 int _rows; 00106 00107 }; 00108 00109 } 00110 00111 #endif
Generated on Tue Jul 26 2022 23:43:13 by
1.7.2