Dependents: vmConfort_v6 Programski_zadatak_23 Projektni_zadatak_23 tempivolt
Diff: Display1602.cpp
- Revision:
- 1:fc4c861451e1
- Parent:
- 0:6c0e68e0d876
--- a/Display1602.cpp Fri Apr 06 19:22:15 2012 +0000 +++ b/Display1602.cpp Sun Apr 08 12:51:51 2012 +0000 @@ -2,7 +2,7 @@ #include "Display1602.h" Display1602::Display1602(PinName registerSelect,PinName readWriteSelect,PinName readWriteEnable,PinName d0,PinName d1,PinName d2,PinName d3,PinName d4,PinName d5,PinName d6,PinName d7) - : rs(registerSelect), rw(readWriteSelect), e(readWriteEnable), bf(d7), data(d0,d1,d2,d3,d4,d5,d6,d7) + : rs(registerSelect), rw(readWriteSelect), e(readWriteEnable), data(d0,d1,d2,d3,d4,d5,d6,d7) { //To ensure we have waited 15ms after power up and VDD > 4.5v (don't know how to test VDD) wait_ms(20); @@ -12,7 +12,7 @@ //Set interface to 8 bit mode SendCommand(0x38); - wait_ms(1); + wait_ms(1); //Display off SendCommand(0x08); @@ -37,21 +37,21 @@ void Display1602::Print(const char *text) { - int n = 16; - while (*text && n--) - { - SendChar(*text); - text++; - } + int n = 16; + while (*text && n--) + { + SendChar(*text); + text++; + } } void Display1602::printf(const char *format,...) { va_list args; - char buf[16]; + char buf[17]; va_start(args, format); - vsnprintf(buf,16,format, args); + vsnprintf(buf,17,format, args); va_end(args); Print(buf); @@ -59,14 +59,14 @@ void Display1602::SetXY(int x,int y) { - if (y == 0) - { - SendCommand (0x80 | x); - } - else - { - SendCommand (0xC0 | x); - } + if (y == 0) + { + SendCommand (0x80 | x); + } + else + { + SendCommand (0xC0 | x); + } } void Display1602::SendCommand(int cmd)