Conversor BCD a 7 segmentos catodo común de 0 a 9

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
DanielOlarte
Date:
Tue Aug 16 23:55:02 2016 +0000
Commit message:
Conversor BCD a siete segmentos Catodo com?n de 0 a 9

Changed in this revision

SieteSeg.cpp Show annotated file Show diff for this revision Revisions of this file
SieteSeg.h 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 80067b94f699 SieteSeg.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SieteSeg.cpp	Tue Aug 16 23:55:02 2016 +0000
@@ -0,0 +1,32 @@
+#include "SieteSeg.h"
+
+int dec[10]= {0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x67};
+
+void Seg::configin(PinName dip1,PinName dip2,PinName dip3,PinName dip4)
+{
+    _dip1=dip1;
+    _dip2=dip2;
+    _dip3=dip3;
+    _dip4=dip4;
+}
+
+void Seg::configout(PinName a,PinName b,PinName c,PinName d,PinName e,PinName f,PinName g)
+{
+    _a=a;
+    _b=b;
+    _c=c;
+    _d=d;
+    _e=e;
+    _f=f;
+    _g=g;
+}
+
+
+void Seg::vis ()
+{
+    BusOut disp(_a,_b,_c,_d,_e,_f,_g);
+
+    BusIn dipsw(_dip1,_dip2,_dip3,_dip4);
+
+    disp=dec[dipsw];
+}
diff -r 000000000000 -r 80067b94f699 SieteSeg.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SieteSeg.h	Tue Aug 16 23:55:02 2016 +0000
@@ -0,0 +1,34 @@
+#ifndef SieteSeg
+#define SieteSeg_h
+#include "mbed.h"
+
+class Seg
+
+{
+public:
+
+
+    void configout(PinName a,PinName b,PinName c,PinName d,PinName e,PinName f,PinName g);
+    void configin(PinName dip1,PinName dip2,PinName dip3,PinName dip4);
+    void vis();
+
+private:
+
+    PinName _a;
+    PinName _b;
+    PinName _c;
+    PinName _d;
+    PinName _e;
+    PinName _f;
+    PinName _g;
+
+    PinName _dip1;
+    PinName _dip2;
+    PinName _dip3;
+    PinName _dip4;
+
+    int _num;
+};
+
+#endif
+
diff -r 000000000000 -r 80067b94f699 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Aug 16 23:55:02 2016 +0000
@@ -0,0 +1,14 @@
+#include "SieteSeg.h"
+
+int main()
+{
+    Seg lab2;
+    lab2.configin(D2,D3,D4,D5);
+    lab2.configout(D7,D8,D9,D10,D11,D12,D13);
+
+    while(1) {
+
+        lab2.vis();
+    }
+
+}
\ No newline at end of file
diff -r 000000000000 -r 80067b94f699 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Aug 16 23:55:02 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/f9eeca106725
\ No newline at end of file