A TextLCD interface for driving 4-bit 16x2 KS0066U LCD
Dependents: KS0066U4_16x2 LAB05_Oppgave4 LAB05_Oppgave2 LAB05_Oppgave3 ... more
Import library
Public Member Functions |
|
TextLCD (PinName rs, PinName rw, PinName e, PinName d4, PinName d5, PinName d6, PinName d7, const char *name=NULL) | |
Create a
TextLCD
interface and initiated 16x2 char mode.
|
|
void | lcdComand (unsigned char cmd) |
Writes a Command to the LCD-module.
|
|
void | lcdData (unsigned char data) |
Writes charecters to the LCD display.
|
|
void | gotoxy (int, int) |
moves text cursor to a screen column and row
|
|
int | putc (int c) |
Write a character to the LCD.
|
|
int | printf (const char *format,...) |
Write a formatted string to the LCD.
|
|
Protected Member Functions |
|
void | writeLcdBitD4toD7 (char data) |
Writes the low nible of data to the LCD-module.
|
|
void | pulseEn () |
Causes the LCD-module to read the data on the data input pins EN = 1 for L-to-H / EN = 0 for H-to-L.
|
|
void | init_4BitMode2LinesDisplayOn () |
Enable 4 bit mode From KS0066U Documentation.
|
TextLCD.h@3:d2f70de20dbe, 2015-09-20 (annotated)
- Committer:
- rlanghbv
- Date:
- Sun Sep 20 11:06:45 2015 +0000
- Revision:
- 3:d2f70de20dbe
- Parent:
- 2:f0a520c95838
- Child:
- 4:264d9b06bf60
Added constutcor width pin-names
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
rlanghbv | 1:8902f6be12a5 | 1 | /* |
rlanghbv | 1:8902f6be12a5 | 2 | * LCD.h |
rlanghbv | 1:8902f6be12a5 | 3 | * |
rlanghbv | 1:8902f6be12a5 | 4 | * Created: 20.01.2012 13:05:14 |
rlanghbv | 1:8902f6be12a5 | 5 | * Author: rul |
rlanghbv | 1:8902f6be12a5 | 6 | */ |
rlanghbv | 1:8902f6be12a5 | 7 | #ifndef LCD_H_ |
rlanghbv | 1:8902f6be12a5 | 8 | #define LCD_H_ |
rlanghbv | 1:8902f6be12a5 | 9 | class TextLCD : public Stream |
rlanghbv | 1:8902f6be12a5 | 10 | { |
rlanghbv | 1:8902f6be12a5 | 11 | public: |
rlanghbv | 1:8902f6be12a5 | 12 | |
rlanghbv | 1:8902f6be12a5 | 13 | //Enables the LCD Module for use 2-Lines... |
rlanghbv | 3:d2f70de20dbe | 14 | TextLCD(PinName rs,PinName rw, PinName e, PinName d4, PinName d5, |
rlanghbv | 3:d2f70de20dbe | 15 | PinName d6, PinName d7) ; |
rlanghbv | 1:8902f6be12a5 | 16 | // EN = 1 for L-to-H / |
rlanghbv | 1:8902f6be12a5 | 17 | // EN = 0 for H-to-L |
rlanghbv | 1:8902f6be12a5 | 18 | // Causes the LCD-module to read the data on the data input pins |
rlanghbv | 1:8902f6be12a5 | 19 | void pulseEn(); |
rlanghbv | 1:8902f6be12a5 | 20 | |
rlanghbv | 1:8902f6be12a5 | 21 | //Writes the low lible of data to the LCD-module data pins D4 to D7 |
rlanghbv | 1:8902f6be12a5 | 22 | void writeLcdBitD4toD7(char ); |
rlanghbv | 1:8902f6be12a5 | 23 | |
rlanghbv | 1:8902f6be12a5 | 24 | //Writes the byte comand to the LCD-module using 4 bits mode |
rlanghbv | 1:8902f6be12a5 | 25 | void lcdComand(unsigned char); |
rlanghbv | 1:8902f6be12a5 | 26 | |
rlanghbv | 1:8902f6be12a5 | 27 | //Writes charecters to the LCD display |
rlanghbv | 1:8902f6be12a5 | 28 | void lcdData(unsigned char); |
rlanghbv | 1:8902f6be12a5 | 29 | |
rlanghbv | 1:8902f6be12a5 | 30 | //Enable 4 bit mode From KS0066U Documentation |
rlanghbv | 1:8902f6be12a5 | 31 | void init_4BitMode2LinesDisplayOn(); |
rlanghbv | 1:8902f6be12a5 | 32 | |
rlanghbv | 1:8902f6be12a5 | 33 | |
rlanghbv | 1:8902f6be12a5 | 34 | //Moves cursor to the X,Y position |
rlanghbv | 2:f0a520c95838 | 35 | void gotoxy(int , int ); |
rlanghbv | 1:8902f6be12a5 | 36 | |
rlanghbv | 1:8902f6be12a5 | 37 | //Writes a string to the LCD Display |
rlanghbv | 1:8902f6be12a5 | 38 | void lcd_print(char *); |
rlanghbv | 1:8902f6be12a5 | 39 | |
rlanghbv | 1:8902f6be12a5 | 40 | protected: |
rlanghbv | 1:8902f6be12a5 | 41 | // Stream implementation functions |
rlanghbv | 1:8902f6be12a5 | 42 | virtual int _putc(int value); |
rlanghbv | 1:8902f6be12a5 | 43 | virtual int _getc(); |
rlanghbv | 3:d2f70de20dbe | 44 | |
rlanghbv | 3:d2f70de20dbe | 45 | DigitalOut LCD_RS,LCD_RW,LCD_EN; |
rlanghbv | 3:d2f70de20dbe | 46 | DigitalOut LCD_D4,LCD_D5,LCD_D6,LCD_D7; |
rlanghbv | 3:d2f70de20dbe | 47 | |
rlanghbv | 3:d2f70de20dbe | 48 | |
rlanghbv | 1:8902f6be12a5 | 49 | }; |
rlanghbv | 1:8902f6be12a5 | 50 | |
rlanghbv | 1:8902f6be12a5 | 51 | #endif /* LCD_H_ */ |