Professional Documents
Culture Documents
Secuencia Led
Secuencia Led
// CONFIG2
#pragma config BOR4V = BOR40V // Brown-out Reset Selection bit (Brown-out Reset
set to 4.0V)
#pragma config WRT = OFF // Flash Program Memory Self Write Enable bits
(Write protection off)
#include <xc.h>
#define _XTAL_FREQ 10000000
#define in1 RD0
#define in2 RD1
#define time 10
void main(void)
{
ANSEL = 0;
ANSELH = 0;
TRISD = 0;
while(1)
{
// in1 = 0;
// in2 = 1;
//
// __delay_ms(4000);
//
// in1 = 1;
// in2 = 0;
//
// __delay_ms(4000);
PORTD = 0b10000000;
__delay_ms(time);
PORTD = 0b01000000;
__delay_ms(time);
PORTD = 0b00100000;
__delay_ms(time);
PORTD = 0b00010000;
__delay_ms(time);
PORTD = 0b00001000;
__delay_ms(time);
PORTD = 0b00000100;
__delay_ms(time);
PORTD = 0b00000010;
__delay_ms(time);
PORTD = 0b00000001;
__delay_ms(time);
PORTD = 0b00000010;
__delay_ms(time);
PORTD = 0b00000100;
__delay_ms(time);
PORTD = 0b00001000;
__delay_ms(time);
PORTD = 0b00010000;
__delay_ms(time);
PORTD = 0b00100000;
__delay_ms(time);
PORTD = 0b01000000;
__delay_ms(time);
PORTD = 0b10000000;
__delay_ms(time);
}
}