TextLCD library for controlling various LCD panels based on the HD44780 4-bit interface
Revision 9:613720545be0, committed 22 months ago
- Comitter:
- dokken
- Date:
- Mon Dec 19 23:44:46 2022 +0000
- Parent:
- 8:308d188a2d3a
- Commit message:
- test
Changed in this revision
| TextLCD.cpp | Show annotated file Show diff for this revision Revisions of this file |
| TextLCD.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/TextLCD.cpp Thu Jan 02 21:07:01 2014 +0000
+++ b/TextLCD.cpp Mon Dec 19 23:44:46 2022 +0000
@@ -47,6 +47,28 @@
cls();
}
+
+void TextLCD::init(void)
+{
+ _e = 1;
+ _rs = 0; // command mode
+
+ wait(0.015); // 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
+ }
+ writeByte(0x2); // 4-bit mode
+ wait(0.000040f); // most instructions take 40us
+
+ writeCommand(0x28); // Function set 001 BW N F - -
+ writeCommand(0x0C);
+ writeCommand(0x6); // Cursor Direction and Display Shift : 0000 01 CD S (CD 0-left, 1-right S(hift) 0-no, 1-yes
+}
+
+
void TextLCD::character(int column, int row, int c) {
int a = address(column, row);
writeCommand(a);
--- a/TextLCD.h Thu Jan 02 21:07:01 2014 +0000
+++ b/TextLCD.h Mon Dec 19 23:44:46 2022 +0000
@@ -87,6 +87,8 @@
int rows();
int columns();
+
+ void init(); // オリジナル初期化メソッド
protected: