Rod Coleman / I2CTextLCD
Revision:
4:d3b7c4237e9d
Parent:
3:4b9faffb3f98
Child:
5:4a4cea387d8e
--- a/I2CTextLCD.cpp	Fri Aug 26 12:28:31 2011 +0000
+++ b/I2CTextLCD.cpp	Fri Aug 26 12:39:38 2011 +0000
@@ -47,10 +47,10 @@
  // Winstar 20x4 WH2004-NYG- needs 40ms after VDD> 4,5V
      wait(0.05);
 // send "Display Settings" 3 times (Only top nibble of 0x30 as we've got 4-bit bus)
-//for (int i=0; i<3; i++) {
-//     writeCommand(0x3); //send 3 times mode
-//      wait(0.00164);      // this command takes 1.64ms, so wait for it
-//    }
+for (int i=0; i<3; i++) {
+     writeCommand(0x3); //send 3 times mode
+      wait(0.00164);      // this command takes 1.64ms, so wait for it
+    }
     writeCommand(0x2); // 4-bit mode
     wait(0.01);
     writeCommand(0x2); // 4-bit mode
@@ -112,16 +112,16 @@
     _row = row;
     _column = column;
     int address = 0x80;
-    if (row==1){
+    if (row==0){
     address = 0x80+_column;
     }
-    else if (row==0){
+    else if (row==1){
     address= 0xc0+_column;
     }
-    else if (row==3){
+    else if (row==2){
     address=0x94+_column;
     }
-    else if(row==2){
+    else if(row==3){
     address=0xd4+_column;
     }
     /*
@@ -135,7 +135,7 @@
 
 void I2CTextLCD::cls() {
     writeCommand(0x01); // Clear Display
-    wait(0.007f);     // This command takes 1.64 ms (LCD), 6.2ms for Winstar OLED
+    wait(0.01f);     // This command takes 1.64 ms (LCD), 6.2ms for Winstar OLED
     locate(0, 0);
 }