Custovic Haris Dautbegovic Amra

Dependencies:   N5110 mbed

Files at this revision

API Documentation at this revision

Comitter:
tim010
Date:
Mon Jun 02 18:38:58 2014 +0000
Commit message:
Projekat-Oscilloskop;

Changed in this revision

N5110.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 7dfa222d4f12 N5110.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/N5110.lib	Mon Jun 02 18:38:58 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/eencae/code/N5110/#7701f0126ba7
diff -r 000000000000 -r 7dfa222d4f12 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Jun 02 18:38:58 2014 +0000
@@ -0,0 +1,118 @@
+#include "mbed.h"
+#include "N5110.h"
+#include <string>
+
+Ticker osvjezi;
+InterruptIn povecaj(dp1);
+Timer dbc;
+N5110 lcd (dp13 ,dp24 ,dp23 ,dp25 ,dp2 ,dp6 , dp18);
+     double w=0.02;
+
+int cenPixelX, cenPixelY, prevCenPixelX, prevCenPixelY;
+DigitalOut enable(dp14);
+AnalogIn ain(dp9);
+int n(17);
+Ticker t;
+AnalogIn vrijeme(dp10);
+void ispisiMrezu() {
+    char znakovi[50] = "U/p: ";
+    int x;
+    if (n==17) x=2;
+    else if (n==33) x=1;
+       
+    znakovi[5]=x+'0';   
+    znakovi[6]=' ';   
+    znakovi[7]='t';   
+    znakovi[8]='/';   
+    znakovi[9]='p';
+       
+    znakovi[10]=':';   
+    if (w == 0.025)
+    {
+        znakovi[11]='3';
+          znakovi[12]=' ';
+        
+        znakovi[13]=' ';
+    }
+    else if (w == 0.0125)
+    {
+                znakovi[11]='2';
+          znakovi[12]=' ';
+        
+        znakovi[13]=' ';
+    }
+    else if (w==0.00625) {
+
+        znakovi[11] = '1';
+        znakovi[12]=' ';
+        
+        znakovi[13]=' ';
+
+    }
+    else
+    { 
+        znakovi[11] = '0';
+        znakovi[12] = '.';
+        znakovi[13] = '5';
+        
+    }
+    lcd.printString(znakovi, 0, 0);
+    for (int i=0;i<75;i=i+10)
+        for (int j=6;j<48;j++)
+            lcd.setPixel(i, j);    
+    
+   
+        for (int j=6;j<44;j=j+10)
+             for (int i=0;i<84;i++)
+                 lcd.setPixel(i, j);    
+    
+    for (int i=0;i<83;i++) lcd.setPixel(i,47);
+    
+    for (int i=6;i<47;i++) lcd.setPixel(83,i);
+    lcd.refresh();
+    
+}
+
+ void dodaj() {
+     if (dbc.read()>0.2) {
+     if(n>22) n=5;
+     else n++;
+     dbc.reset();
+     }
+ }
+ 
+ void povecajAmplitudu() {
+     if (dbc.read()>0.2) {
+     if (n==17) n=33;
+     else n=17;
+     dbc.reset();
+     }
+     }
+ 
+int main()
+{
+    dbc.start();
+    povecaj.rise(&povecajAmplitudu);
+    lcd.init();
+    lcd.clear();
+    lcd.setXYAddress(0,0);
+    int x=0;
+    int y;
+    lcd.setPixel(0,24);
+    lcd.refresh();
+    int tmp;
+    while(1) {
+        ispisiMrezu();
+        if (x==0)  y=tmp;
+        else y = 6+ain*n;
+        lcd.setPixel(x,y);
+        x++;
+        if (x>83) {tmp=y; x=0; lcd.clear(); }
+        lcd.refresh();
+        if (vrijeme<0.25) w=0.025;
+        else if (vrijeme <0.5) w=0.0125;
+        else if (vrijeme <0.75) w=0.00625;
+        else w=0.00625/2;
+        wait(w);
+    }
+}
\ No newline at end of file
diff -r 000000000000 -r 7dfa222d4f12 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Jun 02 18:38:58 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/0b3ab51c8877
\ No newline at end of file