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

Dependencies:   mbed

Revision:
0:80067b94f699
--- /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];
+}