Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: I2CTextLCD.cpp
- Revision:
- 7:dd2dcba75885
- Parent:
- 6:bc76b6a20bfb
- Child:
- 8:4816fdd57607
--- a/I2CTextLCD.cpp Wed Nov 23 08:17:39 2011 +0000
+++ b/I2CTextLCD.cpp Wed Nov 23 11:39:39 2011 +0000
@@ -45,24 +45,31 @@
_backlight=backlight;
//_i2c.frequency(70000);
// Winstar 20x4 WH2004-NYG- needs 40ms after VDD> 4,5V
- wait(0.5);
-// 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
- }
+ /*
+ wait(0.5);
+ writeCommand(0x2); // 4-bit mode
+ wait(0.05);
+ writeCommand(0x28); // Function set 001 BW N F - -
+ wait(0.05);
+ */
+ //RC:2011-11-23: Newhaven 20x4 OLED data sheet method
writeCommand(0x2); // 4-bit mode
wait(0.05);
-// writeCommand(0x2); // 4-bit mode
-
- writeCommand(0x28); // Function set 001 BW N F - -
+ writeCommand(0x2); // 4-bit mode
wait(0.05);
-// writeCommand(0x28); // Function set 001 BW N F
+ writeCommand(0x28); // display OFF, "Function Set". Newhaven say 0x08, but this loses 2 rows!
+ wait(0.05);
+ writeCommand(0x1); // display clear
wait(0.05);
+ writeCommand(0x6); // entry mode set
+ wait(0.05);
+ writeCommand(0x2); // 4-bit mode
+ wait(0.05);
writeCommand(0x0C); // ON-OFF ctrl: turns display ON, no cursor. Use 0x0E for cursor ON.
/* 0x28 also works for Winstar WEH002004ALPP5N00000 OLED display. 0x29= westEuro fon table, 0x2A = UK/Russian
*/
// Added RC 2011-8-11
+ /*
writeCommand(0x05); // clear display RAM all to 00
wait(0.05); // 6.2ms specified for OLED display to recover from RAM clear
@@ -75,7 +82,7 @@
wait(0.05);
writeCommand (0x01); //clear entire display.
wait(0.07);
-
+*/
}