liamgrazier lcd library 16x02
Fork of LGLCDv2 by
Diff: lglcd.cpp
- Revision:
- 1:9020af47a312
- Parent:
- 0:ef052de2d7d0
- Child:
- 2:d812a2a643bc
--- 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 }