Conversor de BCD a siete segmentos

Dependents:   Nucleo_blink_led voltimetrofuncional

Committer:
briandk
Date:
Sat Aug 19 21:57:50 2017 +0000
Revision:
1:ad0edab33530
Parent:
0:3d7ebc7de009
VOLTIMETRO DE 0 A 3,3 V

Who changed what in which revision?

UserRevisionLine numberNew contents of line
briandk 1:ad0edab33530 1
briandk 1:ad0edab33530 2
briandk 1:ad0edab33530 3
briandk 0:3d7ebc7de009 4 # include "DECO.h"
briandk 0:3d7ebc7de009 5
briandk 1:ad0edab33530 6 int SEG[16]= {0x40,0x79,0x24,0x30,0x19,0x12,0x02,0x58,0x00,0x18,0x08,0x03,0x0b,0x23,0x4f,0x20};
briandk 1:ad0edab33530 7
briandk 1:ad0edab33530 8 /*int anodo::entrada(PinName a,PinName b, PinName c,PinName d)
briandk 1:ad0edab33530 9 {
briandk 1:ad0edab33530 10 BusIn dip(a,b,c,d);
briandk 1:ad0edab33530 11 dipp= dip.read();
briandk 1:ad0edab33530 12 return dipp;
briandk 1:ad0edab33530 13 }*/
briandk 0:3d7ebc7de009 14
briandk 1:ad0edab33530 15
briandk 1:ad0edab33530 16 void anodo::visual (PinName a,PinName b,PinName c,PinName d,PinName e,PinName f,PinName g)
briandk 1:ad0edab33530 17 {
briandk 0:3d7ebc7de009 18 _a=a;_b=b;_c=c;_d=d;_e=e;_f=f;_g=g;
briandk 0:3d7ebc7de009 19
briandk 1:ad0edab33530 20 }
briandk 1:ad0edab33530 21
briandk 1:ad0edab33530 22
briandk 1:ad0edab33530 23 void anodo:: Disp(int number)
briandk 0:3d7ebc7de009 24 {
briandk 1:ad0edab33530 25 BusOut display (_g,_f,_e,_d,_c,_b,_a);
briandk 1:ad0edab33530 26 display=SEG[number];
briandk 1:ad0edab33530 27
briandk 0:3d7ebc7de009 28 }
briandk 1:ad0edab33530 29
briandk 1:ad0edab33530 30
briandk 1:ad0edab33530 31 void anodo::ConfEn(PinName one, PinName two,int uni,int dec,int time)
briandk 1:ad0edab33530 32 {
briandk 1:ad0edab33530 33 DigitalOut Edec(one);
briandk 1:ad0edab33530 34 DigitalOut Euni(two);
briandk 1:ad0edab33530 35
briandk 1:ad0edab33530 36 for(int u=0; u<time; u++)
briandk 1:ad0edab33530 37 {
briandk 1:ad0edab33530 38 Edec=1;
briandk 1:ad0edab33530 39 Euni=0;
briandk 1:ad0edab33530 40 Disp(uni);
briandk 1:ad0edab33530 41 wait(0.005);
briandk 0:3d7ebc7de009 42
briandk 1:ad0edab33530 43 Edec=0;
briandk 1:ad0edab33530 44 Euni=1;
briandk 1:ad0edab33530 45 Disp(dec);
briandk 1:ad0edab33530 46 wait(0.005);
briandk 1:ad0edab33530 47 }
briandk 1:ad0edab33530 48 }