liamgrazier lcd library 16x02
Fork of LGLCDv2 by
lglcd.h@2:d812a2a643bc, 2018-01-09 (annotated)
- Committer:
- liam_grazier
- Date:
- Tue Jan 09 11:32:39 2018 +0000
- Revision:
- 2:d812a2a643bc
- Parent:
- 1:9020af47a312
V9.9
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
liam_grazier | 2:d812a2a643bc | 1 | /* ELEC351 COURSEWORK 2018 |
liam_grazier | 2:d812a2a643bc | 2 | DESIGNED USING MBED ONLINE COMPILER IMPORTED TO KEIL |
liam_grazier | 2:d812a2a643bc | 3 | LIAM GRAZIER // DOUG TILLEY // ALEX BARON |
liam_grazier | 2:d812a2a643bc | 4 | */ |
liam_grazier | 2:d812a2a643bc | 5 | #ifndef __LGLCD_H |
liam_grazier | 0:ef052de2d7d0 | 6 | #define __LGLCD_H |
liam_grazier | 2:d812a2a643bc | 7 | #define CMD 0 //adapted from 2nd year code |
liam_grazier | 2:d812a2a643bc | 8 | #define TXT 1 |
liam_grazier | 2:d812a2a643bc | 9 | #define CLEAR 1 |
liam_grazier | 2:d812a2a643bc | 10 | #define HOME 2 |
liam_grazier | 2:d812a2a643bc | 11 | #define READ 1 |
liam_grazier | 0:ef052de2d7d0 | 12 | #define WRITE 0 |
liam_grazier | 2:d812a2a643bc | 13 | #define LEFT 0 |
liam_grazier | 0:ef052de2d7d0 | 14 | #define RIGHT 1 |
liam_grazier | 0:ef052de2d7d0 | 15 | #define LINE1 0x80 // Start address of first line |
liam_grazier | 0:ef052de2d7d0 | 16 | #define LINE2 0xC0 // Start address of second line |
liam_grazier | 0:ef052de2d7d0 | 17 | #define LCD_CLR (writedata(CLEAR,CMD)) |
liam_grazier | 0:ef052de2d7d0 | 18 | #define LCD_HOME (writedata(HOME,CMD)) |
liam_grazier | 0:ef052de2d7d0 | 19 | #define LCD_BUSYBIT 0x8000 //correct value for the lcd BUSYBIT |
liam_grazier | 2:d812a2a643bc | 20 | //mylcdclass |
liam_grazier | 0:ef052de2d7d0 | 21 | class lglcd |
liam_grazier | 0:ef052de2d7d0 | 22 | { |
liam_grazier | 0:ef052de2d7d0 | 23 | public: |
liam_grazier | 2:d812a2a643bc | 24 | lglcd(PinName RS, PinName E, PinName D4, PinName D5,PinName D6, PinName D7); //statement for pin enables |
liam_grazier | 2:d812a2a643bc | 25 | void clear(void); //function for clearlcd |
liam_grazier | 2:d812a2a643bc | 26 | void writedata(unsigned char info, unsigned char type); //function forwiring data on the screen |
liam_grazier | 2:d812a2a643bc | 27 | void lglcd::setline(int row,int column); //setline command row/column |
liam_grazier | 2:d812a2a643bc | 28 | void write(char charq[]); //wirint char/str on mylcd. |
liam_grazier | 2:d812a2a643bc | 29 | int l; |
liam_grazier | 0:ef052de2d7d0 | 30 | protected: |
liam_grazier | 2:d812a2a643bc | 31 | BusOut _lcdinfo; //output define for D4-D7 |
liam_grazier | 2:d812a2a643bc | 32 | DigitalOut _lcdrs; //output define for RS Pin |
liam_grazier | 2:d812a2a643bc | 33 | DigitalOut _lcde; //output define for E pin |
liam_grazier | 0:ef052de2d7d0 | 34 | }; |
liam_grazier | 0:ef052de2d7d0 | 35 | #endif |