#include <htc.h>
__CONFIG (FOSC_HS & CP_OFF & WDTE_OFF & PWRTE_ON );
#ifndef _XTAL_FREQ
// Unless already defined assume 4MHz system frequency
// This definition is required to calibrate __delay_us() and __delay_ms()
#define _XTAL_FREQ 4000000
#endif
void init(void)
{
// port directions: 1=input, 0=output
TRISB = 0b00000000; //set's portb to output
RB0 = 0; //starts RB0 off
}
void main(void) //main code atfer here
{
init(); //runs startup code
while (1){ //loop
RB0 = 1; // turns led on
__delay_ms(1000); //delay
RB0 = 0; // turns led off
__delay_ms(1000); // delay
}
}