#include //Use this to include the device header for your PIC. //In our case, this will include pic16f690.h. //Do not directly include pic16f690.h to avoid issues if you //change your device later on. Always use . #define _XTAL_FREQ 4000000 //4MHz, which is default //This is used by the compiler to calculate how many //instructions to delay in the calls to __delay_ms(). //set the configuration bits: internal OSC, everything off except MCLR #pragma config FOSC=INTRCIO, WDTE=OFF, PWRTE=OFF, MCLRE=ON, CP=OFF, \ CPD=OFF, BOREN=OFF, IESO=OFF, FCMEN=OFF int main() { TRISA = 0xFF; //set all digital I/O to inputs TRISB = 0xFF; TRISC = 0xFF; ANSEL = 0x00; //disable all analog ports ANSELH = 0x00; TRISBbits.TRISB7 = 0; //set RB7 as an output /////////////////////// // Main Program Loop // /////////////////////// while(1) { PORTBbits.RB7 = 1; //turn on the LED __delay_ms(500); //wait 500ms PORTBbits.RB7 = 0; //turn off the LED __delay_ms(500); //wait 500ms } return 0; }