#include <p18f1220.h>
#include <delays.h>
#pragma config OSC = INTIO1 //using Internal OSC
#pragma config WDT = OFF
#pragma config LVP = OFF
//defining below the LED outputs
#define LED1 LATBbits.LATB0
#define LED2 LATBbits.LATB1
#define LED3 LATBbits.LATB2
#define LED4 LATBbits.LATB3
#define LED5 LATBbits.LATB4
#define LED6 LATBbits.LATB5
#define LED7 LATBbits.LATB6
#define LED8 LATBbits.LATB7
void main(void)
{
//Internal Oscillator Frequency @ 8MHz
OSCCONbits.IRCF2 = 1;
OSCCONbits.IRCF1 = 1;
OSCCONbits.IRCF0 = 1;
ADCON1 = 0b11111111; //All channels Digital
PORTA = 0; //intialize PORTA
PORTB = 0; //intialize PORTB
TRISB = 0x00; //PORTB as all OUTPUT
INTCON = 0; //Disable all interrupts
while(1) //loop forever
{
//MAKE all LEDs turn on
LED1 = 1;
LED2 = 1;
LED3 = 1;
LED4 = 1;
LED5 = 1;
LED6 = 1;
LED7 = 1;
LED8 = 1;
Delay10KTCYx(100); //500ms delay @ 8MHz
//MAKE all LEDs turn off
LED1 = 0;
LED2 = 0;
LED3 = 0;
LED4 = 0;
LED5 = 0;
LED6 = 0;
LED7 = 0;
LED8 = 0;
Delay10KTCYx(100); //500ms delay @ 8MHz
}
} //end of main()