You are on page 1of 1

/*

* File: Proyecto_led.c
* Author: Haret
*
* Created on 22 de junio de 2016, 11:39
*/

// CONFIG
#pragma config FOSC = XT // Oscillator Selection bits (XT oscillator)
#pragma config WDTE = OFF // Watchdog Timer (WDT disabled)
#pragma config PWRTE = ON // Power-up Timer Enable bit (Power-up Timer is
enabled)
#pragma config CP = OFF // Code Protection bit (Code protection disabled)
#include <xc.h>

void main()
{
//CONFIGURACION DE LOS PUERTOS
TRISbitsA.TRISA0=0;//Configuracion del puerto A como salida
TRISbitsB.TRISB1=1;//Configuracion del puerto B como salida

PORTA=0;//inicializacion del puerto A en 0


PORTB=0;//inicializacion del puerto B en 0
bucle:
while(1)
{
if(RB1==1)
{
RA0=1;

}
TRISB.TRISB1=0;

if(RB1==1)
{
RA0=0;
}
}
goto bucle;
}

You might also like