El diagrama es:
El codigo es:
void main ( void )
{
TRISB = 0; //SALIDAS
TRISD=0b11111111;
while( 1 )
{
if (Button(&PORTD, 0, 1, 1))
{PORTB = 0b00000011;
Delay_ms(100);
PORTB = 0b00000110;
Delay_ms(100);
PORTB = 0b00001100;
Delay_ms(100);
PORTB = 0b00011000;
Delay_ms(100);
}
if (Button(&PORTD, 1, 1, 1))
{PORTB = 0b00000011;
Delay_ms(100);
PORTB = 0b00001001;
Delay_ms(100);
PORTB = 0b00001100;
Delay_ms(100);
PORTB = 0b00000110;
Delay_ms(100);
}
}
}
Comentarios