KS0108 LCD LIB with I2C I/O expander PCF8574 for Databus
Diff: KS0108.cpp
- Revision:
- 1:8bc625378e38
- Parent:
- 0:f2f71eab6aef
- Child:
- 2:6a8fbb08d519
--- a/KS0108.cpp Sat Apr 21 20:52:05 2012 +0000 +++ b/KS0108.cpp Mon Sep 03 09:32:37 2012 +0000 @@ -45,7 +45,7 @@ wait_us(10); RST.write(1); //reset screen E.write(0); - //ClearScreen(); //clear display + ClearScreen(); //clear display WriteInstruction(LCD_ON, BOTH); //turn on lcd Inverted = 0; } @@ -59,11 +59,11 @@ SelectSide(side); //select controller - wait(0.0000005); //wait 300ns + wait(0.0000003); //wait 300ns E.write(1); DB.output(); DB.write(Command); - wait(0.0000005); + wait(0.0000001); E.write(0); } @@ -75,11 +75,11 @@ SelectSide(side); - wait(0.0000005); // 300ns + wait(0.0000003); // 300ns E.write(1); DB.output(); DB.write(data); - wait(0.0000005); + wait(0.0000001); E.write(0); } @@ -89,7 +89,7 @@ if(Coord.x >= SCREEN_WIDTH) return; chip = Coord.x/CHIP_WIDTH; - wait(0.0000007); // 300ns + wait(0.000000450); // 300ns if(Coord.x % CHIP_WIDTH == 0 && chip > 0){ GotoXY(Coord.x, Coord.y); @@ -113,9 +113,9 @@ displayData |= data << yOffset; if(Inverted) displayData = ~displayData; DB.write(displayData); // write data - wait(0.0000005); // 300ns + wait(0.0000003); // 300ns E.write(1); - wait(0.0000005); + wait(0.0000001); E.write(0); // second page @@ -135,9 +135,9 @@ displayData = ~displayData; DB.write(displayData); // write data - wait(0.0000005); // 300ns + wait(0.0000003); // 300ns E.write(1); - wait(0.0000005); + wait(0.0000001); E.write(0); GotoXY(Coord.x+1, Coord.y-8); @@ -146,11 +146,11 @@ // just this code gets executed if the write is on a single page if(Inverted) data = ~data; - wait(0.0000005); // 300nsEN_DELAY(); + wait(0.0000003); // 300nsEN_DELAY(); DB.write(data); // write data - wait(0.0000005); // 300ns + wait(0.0000003); // 300ns E = 1; - wait(0.0000005); + wait(0.0000001); E = 0; Coord.x++; } @@ -191,13 +191,13 @@ RW.write(1); E.write(1); - wait(0.0000007); + wait(0.00000045); data = DB.read(); - wait(0.0000007); + wait(0.0000001); E.write(0); DB.output(); - // DB.mode(OpenDrain); + return data; } @@ -209,11 +209,11 @@ RW.write(1); E.write(1); - wait(0.0000007); + wait(0.00000045); status = DB.read(); E.write(0); - wait(0.0000007); + wait(0.0000001); DB.output(); return status; @@ -795,7 +795,7 @@ } c-= firstChar; - if( FontRead(Font+FONT_LENGTH) == 0 && FontRead(Font+FONT_LENGTH+1) == 0) {//////////////////////////// + if( FontRead(Font+FONT_LENGTH) == 0 && FontRead(Font+FONT_LENGTH+1) == 0) { // zero length is flag indicating fixed width font (array does not contain width data entries) width = FontRead(Font+FONT_FIXED_WIDTH); index = c*bytes*width+FONT_WIDTH_TABLE; @@ -824,7 +824,7 @@ } // 1px gap between chars WriteData(0x00); - GotoXY(x,y+8);//GotoXY(x,Coord.y+8); + GotoXY(x,Coord.y+8); } GotoXY(x+width+1, y); @@ -869,4 +869,3 @@ -