LED Blinking with PIC16F627A Microcontroller in MPLAB IDE
#include <stdio.h>
#include <stdlib.h>
#include <xc.h>
#define _XTAL_FREQ 2000000
__CONFIG(FOSC_HS & WDTE_OFF & PWRTE_OFF & MCLRE_OFF & BOREN_OFF & LVP_ON & CPD_OFF & CP_OFF);
void main()
{
TRISA = 0;// set all pins of Port A as OUTPUT
TRISB = 0;// set all pins of Port B as OUTPUT
while(1)// Infinite Loop to execute the code Continuously.
{
RA0=1;//Turn HIGH the Pin A0 at portA
RB0=0;//Turn LOW the Pin B0 at portB
__delay_ms(1000); //Delay 1 second
RA0=0;//Turn LOW the Pin A0 at portA
RB0=1;//Turn HIGH the Pin A0 at portB
__delay_ms(1000); //Delay 1 second
}
}
Comments
Post a Comment