Controlador de pinos led 7 seg - isis
int digitos[10] = {
(0b00111111),
(0b00000110),
(0b01011011),
(0b01001111),
(0b01100110),
(0b01101101),
(0b01111101),
(0b00000111),
(0b01111111),
(0b01100111)
};
void contar_1_a_9(){
//1 a 9 unidade;
output_b(digitos[1]);
delay_ms(500);
output_b(digitos[2]);
delay_ms(500);
output_b(digitos[3]);
delay_ms(500);
output_b(digitos[4]);
delay_ms(500);
output_b(digitos[5]);
delay_ms(500);
output_b(digitos[6]);
delay_ms(500);
output_b(digitos[7]);
delay_ms(500);
output_b(digitos[8]);
delay_ms(500);
output_b(digitos[9]);
delay_ms(500);
}
void main()
{
setup_adc_ports(NO_ANALOGS);
setup_adc(ADC_CLOCK_DIV_2);
setup_psp(PSP_DISABLED);
setup_spi(SPI_SS_DISABLED);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
do {
output_b(0b00000000);
output_c(0b00000000);
//zero dezena
output_high(pin_c0);
output_high(pin_c1);
output_high(pin_c2);
output_high(pin_c3);
output_high(pin_c4);
output_high(pin_c5);
//zero unidade
output_b(0b00111111);
delay_ms(200);
contar_1_a_9();
//1 dezena
output_c(0b00000000);
output_high(pin_c1);
output_high(pin_c2);
//zero unidade
output_b(0b00111111);
delay_ms(200);
contar_1_a_9();
//2 dezena
output_c(0b00000000);
output_high(pin_c0);
output_high(pin_c1);
output_high(pin_c3);
output_high(pin_c4);