Red de conocimiento informático - Conocimiento informático - ¡Escribe un programa para mí usando el chip PIC12F683!

¡Escribe un programa para mí usando el chip PIC12F683!

#include

retraso nulo(int x)

{

int a,b;

for(a =x;a>0;a--)

for(b=110;b>0;b--);

}

void principal ()

{

ANSEL=0;

CMCON0=0X07;

int a,b,c,d;

p>

GPIO=0;

TRISIO0=1;

TRISIO1=1;

TRISIO2=0;

TRISIO3 =0;

TRISIO4=0;

TRISIO5=1;

si(GPIO5==0)

{

/// No se agrega ninguna función antirrebote aquí

while(1)

{

if((GPIO0== 0)&&( GPIO1==0))

{

retraso(5);

si ((GPIO0==0)&&(GPIO1== 0))

{

GPIO2=0 ; //luz LED1

GPIO3=1;//luz LED1

GPIO4= 1;// luz LED1

}

}

}

if((GPIO0==1)&&(GPIO1== 0))

{

retraso(5);

if((GPIO0==1)&&(GPIO1==0))

{

GPIO2=1;/Luz LED1

GPIO3=0;/Luz LED1

GPIO4=1;//Luz LED1

}

}

if((GPIO0==1)&&(GPIO1==1))

{

retraso(5 );

if((GPIO0==1)&&(GPIO1==1))

{ GPIO2=1;//luz LED1

GPIO3= 1;//luz LED1

GPIO4=0; //luz LED1

}

}

if( (GPIO0== 0)&&(GPIO1==1))

{

retraso(5);

if((GPIO0==0)&& (GPIO1== 1))

{

mientras(1)

{

for(a=1000;a>0 ;a-- )

{

GPIO2=0;//luz LED1

GPIO3=1;//luz LED1

GPIO4=1; //luz LED1

}

for(a=1000;a>0;a--)

{

GPIO2= 1;//encender LED1

GPIO3=1;//encender LED1

GPIO4=1; //ligh

Encienda el LED1

}

}

}

}

}

}

}

}

}

if(GPIO5==1)

{

mientras(1)

{

para(d=3;d>0;d--)

{

for(c=5000;c>0;c--)

{

GPIO2=0; //Enciende el LED1

GPIO3= 1;/Enciende el LED1

GPIO4=1;//enciende el LED1

}

for(c=5000;c>0;c-- )

{

GPIO2=1;//luz LED1

GPIO3=1;//luz LED1

GPIO4 = 1; //enciende el LED1

}

}

delay(500);

for(d=3;d>0; d--)

{

for(c=20000;c>0;c--)

{

GPIO2= 0;//luz LED1

GPIO3=1;//luz LED1

GPIO4=1;//luz LED1

}

for(c=20000;c>0;c--)

{

GPIO2=1;//luz LED1

GPIO2=1;/ /encender LED1

GPIO3=1;//encender LED1

GPIO4=1;//encender LED1

}

}

retraso(500);

}

}

}

}

}

}

}

}

}

}