tim007 tim007
/
lv8_tim007_grupa5_zad3
Elma Kusundzija Amela Spica
Revision 0:91269f323f72, committed 2014-05-08
- Comitter:
- tim007
- Date:
- Thu May 08 14:04:36 2014 +0000
- Commit message:
- lv8_tim007_grupa5_zad3
Changed in this revision
diff -r 000000000000 -r 91269f323f72 N5110.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/N5110.lib Thu May 08 14:04:36 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/eencae/code/N5110/#adb79338d40f
diff -r 000000000000 -r 91269f323f72 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu May 08 14:04:36 2014 +0000 @@ -0,0 +1,97 @@ +#include "mbed.h" +#include "N5110.h" + +Serial pc(USBTX, USBRX); +N5110 display(dp4,dp24,dp23,dp25,dp2,dp6,dp18); +int x=0; +int y=0; + +void ispisi(char znak) +{ + display.printChar(znak); + x = x + 6; + if(x==84 && y==6)return; + if(x==84) + { + x = 0; + y = y + 1; + } + display.setXYAddress(x,y); +} +void backspace() +{ + if(x==0 && y==0) + { + /*x = 84; + y = 40;*/ + return; + } + else if(x==0) + { + y = y - 1; + x = 78; + display.setXYAddress(x,y); + ispisi(' '); + x=x-6; + display.setXYAddress(x,y); + + } + else if(x==78) + { + x=x-6; + display.setXYAddress(x,y); + ispisi(' '); + x=x-6; + display.setXYAddress(x,y); + } + else + {x=x-6; + display.setXYAddress(x,y); + ispisi(' '); + x=x-6; + display.setXYAddress(x,y); + + } + /*display.setXYAddress(x,y); + ispisi(' '); + if(x==0){ + y=y-1; + x=84;} + else {x=x-6;} + display.setXYAddress(x,y);*/ + +} +void DeleteAll() +{ + display.clear(); + display.refresh(); + x = y = 0; + display.setXYAddress(x,y); +} +void Enter() +{ + if(y==40) return; + else y = y + 1; + x = 0; + display.setXYAddress(x,y); + +} +int main() +{ + display.init(); + display.normalMode(); + display.setXYAddress(0,0); + + while(1) + { + char znak = pc.getc(); + if(znak==',') + backspace(); + else if(znak=='.') + DeleteAll(); + else if(znak=='-') + Enter(); + else ispisi(znak); + } + +}
diff -r 000000000000 -r 91269f323f72 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu May 08 14:04:36 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/8a40adfe8776 \ No newline at end of file