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:
- 3:4b9faffb3f98
- Parent:
- 2:24c878e63f10
- Child:
- 4:d3b7c4237e9d
--- a/I2CTextLCD.cpp Tue Aug 23 11:29:30 2011 +0000
+++ b/I2CTextLCD.cpp Fri Aug 26 12:28:31 2011 +0000
@@ -47,25 +47,26 @@
// 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
writeCommand(0x28); // Function set 001 BW N F - -
- wait(0.001);
+ wait(0.01);
writeCommand(0x28); // Function set 001 BW N F
- wait(0.001);
- writeCommand(0x0C); // turns display ON, no cursor. Use 0x0E for cursor ON.
+ wait(0.01);
+ 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(0x01); // clear display RAM all to 00
- wait(0.007); // 6.2ms specified for OLED display to recover from RAM clear
+ wait(0.01); // 6.2ms specified for OLED display to recover from RAM clear
- writeCommand(0x06); // Cursor Direction and Display Shift : 0000 01 CD S (CD 0-left, 1-right S(hift) 0-no, 1-yes
+ writeCommand(0x06); // Entry mode Set. Cursor Direction and Display Shift : 0000 01 CD S (CD 0-left, 1-right S(hift) 0-no, 1-yes
cls();
@@ -111,16 +112,16 @@
_row = row;
_column = column;
int address = 0x80;
- if (row==0){
+ if (row==1){
address = 0x80+_column;
}
- else if (row==1){
+ else if (row==0){
address= 0xc0+_column;
}
- else if (row==2){
+ else if (row==3){
address=0x94+_column;
}
- else if(row==3){
+ else if(row==2){
address=0xd4+_column;
}
/*