It makes two seven segments count from 0 to 99

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
EduRemo
Date:
Fri Feb 05 07:05:30 2016 +0000
Commit message:
At FRCRCE

Changed in this revision

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 fb420818dd95 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri Feb 05 07:05:30 2016 +0000
@@ -0,0 +1,85 @@
+#include "mbed.h"
+
+BusOut Disp(PTC9, PTC8, PTA5,PTA4, PTA12,PTD4,PTA2,PTA1); // ABCDEFGdp
+DigitalOut vdd1(PTA13); // (for selecting Ten's digit give vcc here)
+DigitalOut vdd2(PTD5); // (for selecting One's digit give vcc here)
+
+void show_number(int m);
+
+void set_Tens_Digit()
+{vdd1 = 1;
+vdd2 =0;}
+
+void set_Ones_Digit()
+{vdd1 = 0;
+vdd2 = 1;}
+
+int i = 0;
+int j = 0;
+int k = 0;
+int m = 0;
+int n = 0;
+
+int main() {
+    while(1){
+        for (i=0; i<=99; i++){
+            j = i / 10;
+            k = i % 10;
+        for(n=0; n<99; n++){
+            set_Tens_Digit();
+            show_number(j);
+            set_Ones_Digit();
+            show_number(k);}
+            }
+        }
+}
+
+
+void show_number(int m)
+{
+    switch(m)
+    {
+     case 0:
+       Disp = 0xC0; 
+       wait(0.005);  
+       break;
+    case 1:
+       Disp = 0xF9; 
+       wait(0.005); 
+       break;
+    case 2:
+       Disp = 0xA4; 
+       wait(0.005);  
+       break; 
+    case 3:
+       Disp = 0xB0; 
+       wait(0.005);  
+       break;
+    case 4:
+       Disp = 0x99; 
+       wait(0.005);  
+       break;
+    case 5:
+       Disp = 0x92; 
+       wait(0.005);  
+       break;
+    case 6:
+       Disp = 0x82; 
+       wait(0.005);  
+       break;
+    case 7:
+       Disp = 0xF8; 
+       wait(0.005);  
+       break;
+    case 8:
+       Disp = 0x80; 
+       wait(0.005);  
+       break;
+    case 9:
+       Disp = 0x90; 
+       wait(0.005);  
+       break;
+    default:
+        Disp = 0x04; 
+       wait(0.005);  
+       break;}    }
\ No newline at end of file
diff -r 000000000000 -r fb420818dd95 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Fri Feb 05 07:05:30 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/9296ab0bfc11
\ No newline at end of file