Modified TextLCD lib. The RW signal is also connected to a IO pin. This enable to read out the display memory and the busy flag. The timing is switched from delays to wait for the busy flag. Added writeCGRAM function to define user chars 0-7.
Fork of TextLCD by
Revision 4:a7c74d4c6911, committed 2010-12-14
- Comitter:
- dreschpe
- Date:
- Tue Dec 14 16:47:47 2010 +0000
- Parent:
- 3:8582013914a0
- Commit message:
- 0.2 change small delays to __nop();
Changed in this revision
TextLCD.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/TextLCD.cpp Mon Dec 06 00:07:57 2010 +0000 +++ b/TextLCD.cpp Tue Dec 14 16:47:47 2010 +0000 @@ -36,16 +36,16 @@ // send "Display Settings" 3 times (Only top nibble of 0x30 as we've got 4-bit bus) for (int i=0; i<3; i++) { _e = 1; - wait(0.000001f); + __nop(); _d = 0x3; - wait(0.000001f); + __nop(); _e = 0; wait(0.004f); // 4ms } _e = 1; - wait(0.000001f); + __nop(); _d = 0x2; // 4 Bit mode - wait(0.000001f); + __nop(); _e = 0; writeCommand(0x28); // Function set 4 Bit, 2Line, 5*7 @@ -102,15 +102,15 @@ void TextLCD::writeByte(int value) { _e = 1; - wait(0.000001f); + __nop(); _d = value >> 4; - wait(0.000001f); + __nop(); _e = 0; - wait(0.000001f); + __nop(); _e = 1; - wait(0.000001f); + __nop(); _d = value >> 0; - wait(0.000001f); + __nop(); _e = 0; } @@ -125,15 +125,15 @@ waitBusy(); _rw = 1; _rs = 1; - wait(0.000001f); + __nop(); _d.input(); // switch Data port to input _e = 1; - wait(0.000001f); + __nop(); input = _d.read() << 4; // high nibble _e = 0; - wait(0.000001f); + __nop(); _e = 1; - wait(0.000001f); + __nop(); input = input | _d.read(); // low nibble _e = 0; return (input); @@ -143,16 +143,16 @@ int input; _rw = 1; _rs = 0; - wait(0.000001f); + __nop(); _d.input(); // switch Data port to input do{ _e = 1; - wait(0.000001f); + __nop(); input = _d.read(); _e = 0; - wait(0.000001f); + __nop(); _e = 1; - wait(0.000001f); + __nop(); _e = 0; }while((0x8 & input) == 0x8); // wait until display is ready _rw = 0;