Baixe o app para aproveitar ainda mais
Esta é uma pré-visualização de arquivo. Entre para ver o arquivo original
void main() { const char BCD_7SEG[10] = { 0b00111111, //0 0b00000110, //1 0b01011011, //2 0b01001111, //3 0b01100110, //4 0b01101101, //5 0b01111101, //6 0b00100111, //7 0b01111111, //8 0b01100111, //9 }; int i = 0; int x = 0; int n = 0; adcon1 = 0xff; TRISC = 0x00; TRISA = 0x00; TRISD = 0x00; TRISB = 0xff; PORTC = 0x02; PORTA = 0x00; PORTB = 0x00; do { if(portb.RB2 == 0) { x = 0; i = n; PORTA.F2 = 1; portd = BCD_7SEG[n]; DELAY_MS(1000); } if(portb.RB1 == 0) { if(x == 0) { for(i=n;i<10;i++) { PORTA.F2 = 1; portd = BCD_7SEG[i]; DELAY_MS(1000); if(portb.RB0 == 0) { x=1; PORTA.F2 = 1; n = i; i = 11; portd = BCD_7SEG[n]; DELAY_MS(1000); } } portc.RB1 = 0; delay_ms(2000); portc.RB1 = 1; } } }while(1); }
Compartilhar