tim003 tim003
/
LV8_Grupa6_Tim003_Zad3
Haris Spahic Ensar Muratovic
Revision 0:f42394c93668, committed 2014-05-08
- Comitter:
- tim003
- Date:
- Thu May 08 15:51:04 2014 +0000
- Commit message:
- LV8-Grupa6-Tim003-Zad3
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/N5110.lib Thu May 08 15:51:04 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/eencae/code/N5110/#adb79338d40f
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu May 08 15:51:04 2014 +0000 @@ -0,0 +1,71 @@ +#include "mbed.h" +#include "N5110.h" + + +Serial pc(USBTX, USBRX); +N5110 lcd(dp4, dp24, dp23, dp25, dp2, dp6, dp18); + + +int X = 0; +int Y = 0; + +void bckspc() +{ + if(X == 0 && Y == 0) return; + + if(X == 0) + { + Y -= 1; + X = 84; + } + + X -= 6; + lcd.setXYAddress(X, Y); + lcd.printChar(' '); + lcd.setXYAddress(X, Y); +} + +void CLS() +{ + lcd.clear(); + lcd.refresh(); + X = Y = 0; + lcd.setXYAddress(X, Y); +} + +void enter() +{ + if(Y == 5) Y = 0; + else Y ++; + X = 0; + lcd.setXYAddress(X, Y); +} + +void karakter(char c) +{ + lcd.printChar(c); + X += 6; + if(X == 84) + { + Y++; + if(Y == 6) Y = 0; + X = 0; + } +} + +int main() +{ + lcd.init(); + lcd.inverseMode(); + lcd.setXYAddress(0,0); + + while(1) + { + char c = pc.getc(); + if(c == '1') bckspc(); + else if(c == '2') CLS(); + else if(c == '3') enter(); + else karakter(c); + } + +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu May 08 15:51:04 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/8a40adfe8776 \ No newline at end of file