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

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers SieteSeg.cpp Source File

SieteSeg.cpp

00001 #include "SieteSeg.h"
00002 
00003 int dec[10]= {0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x67};
00004 
00005 void Seg::configin(PinName dip1,PinName dip2,PinName dip3,PinName dip4)
00006 {
00007     _dip1=dip1;
00008     _dip2=dip2;
00009     _dip3=dip3;
00010     _dip4=dip4;
00011 }
00012 
00013 void Seg::configout(PinName a,PinName b,PinName c,PinName d,PinName e,PinName f,PinName g)
00014 {
00015     _a=a;
00016     _b=b;
00017     _c=c;
00018     _d=d;
00019     _e=e;
00020     _f=f;
00021     _g=g;
00022 }
00023 
00024 
00025 void Seg::vis ()
00026 {
00027     BusOut disp(_a,_b,_c,_d,_e,_f,_g);
00028 
00029     BusIn dipsw(_dip1,_dip2,_dip3,_dip4);
00030 
00031     disp=dec[dipsw];
00032 }