Thanks to simon For his LCD Driver program

Fork of TextLCD by Simon Ford

Files at this revision

API Documentation at this revision

Comitter:
delairejerome
Date:
Tue Mar 17 09:58:01 2015 +0000
Parent:
6:e4cb7ddee0d3
Commit message:
Drivers for DOGM162E-A LCD display. Thanks to Simon Ford for his HD44780 LCD display driver.

Changed in this revision

TextLCD.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r e4cb7ddee0d3 -r b9fb4716e8f6 TextLCD.cpp
--- a/TextLCD.cpp	Tue Nov 23 14:26:19 2010 +0000
+++ b/TextLCD.cpp	Tue Mar 17 09:58:01 2015 +0000
@@ -28,23 +28,36 @@
         _e(e), _d(d0, d1, d2, d3),
         _type(type) {
 
-    _e  = 1;
+    _e  = 0;
     _rs = 0;            // command mode
-
-    wait(0.015);        // Wait 15ms to ensure powered up
+    
+    wait(0.050);        // Wait 15ms to ensure powered up
 
     // send "Display Settings" 3 times (Only top nibble of 0x30 as we've got 4-bit bus)
-    for (int i=0; i<3; i++) {
-        writeByte(0x3);
-        wait(0.00164);  // this command takes 1.64ms, so wait for it
+    for (int i=0; i<3; i++)  {
+        writeByte(0x30);
+        wait(0.002);  // this command takes 1.64ms, so wait for it
     }
-    writeByte(0x2);     // 4-bit mode
-    wait(0.000040f);    // most instructions take 40us
-
-    writeCommand(0x28); // Function set 001 BW N F - -
+    writeByte(0x2);
+        wait(0.002); 
+    writeCommand(0x29);
+    wait(0.001f);
+    writeCommand(0x14);
+    wait(0.001f);
+    writeCommand(0x55);
+    wait(0.001f);
+    writeCommand(0x6D);
+    wait(0.001f);
+    writeCommand(0x78);
+    wait(0.001f);
+    writeCommand(0x28);
+    wait(0.001f);
     writeCommand(0x0C);
-    writeCommand(0x6);  // Cursor Direction and Display Shift : 0000 01 CD S (CD 0-left, 1-right S(hift) 0-no, 1-yes
-    cls();
+    wait(0.001f);
+    writeCommand(0x01);
+    wait_ms(2);
+    writeCommand(0x06);
+    wait(0.001f);
 }
 
 void TextLCD::character(int column, int row, int c) {