liamgrazier lcd library 16x02
Fork of LGLCD by
Revision 1:9020af47a312, committed 2018-01-05
- Comitter:
- liam_grazier
- Date:
- Fri Jan 05 17:56:27 2018 +0000
- Parent:
- 0:ef052de2d7d0
- Commit message:
- dsaidijsak
Changed in this revision
lglcd.cpp | Show annotated file Show diff for this revision Revisions of this file |
lglcd.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r ef052de2d7d0 -r 9020af47a312 lglcd.cpp --- a/lglcd.cpp Fri Jan 05 14:13:07 2018 +0000 +++ b/lglcd.cpp Fri Jan 05 17:56:27 2018 +0000 @@ -29,13 +29,27 @@ LCD_CLR; wait(0.002); //2ms delay to stop timing error } +void lglcd::setline(int row,int column) +{ + if(row == 1) { // switch statement for placing the cursor + writedata(LINE1|column,CMD); //set lcd to line one and correct position + wait(0.005); //2ms delay to stop empty screen timing error + } + if(row == 2){ + writedata(LINE2|column,CMD); //set lcd to line two and correct position + wait(0.005); //2ms delay to stop empty screen timing error + } + } /*---------------------------------------------------------------------*/ void lglcd::writedata(unsigned char info, unsigned char type) { - if(type == CMD) { + if(type == CMD) + { _lcdrs=0; //COMMAND MODE - } else { + } + else + { _lcdrs=1; //CHARACTER/DATA MODE }
diff -r ef052de2d7d0 -r 9020af47a312 lglcd.h --- a/lglcd.h Fri Jan 05 14:13:07 2018 +0000 +++ b/lglcd.h Fri Jan 05 17:56:27 2018 +0000 @@ -24,6 +24,7 @@ lglcd(PinName rs, PinName e, PinName d4, PinName d5,PinName d6, PinName d7); void clear(void); void writedata(unsigned char info, unsigned char type); +void lglcd::setline(int row,int column); void write(char charq[]); int l; protected: