// Multiple Interrupts!


void interrupt(void)

{

// Service interrupts here!

if(INTCON.B0 == 1)

{

GPIO.B5 = 1;

Delay_ms(100);

GPIO.B5 = 0;

Delay_ms(50);

GPIO.B5 = 1;

Delay_ms(100);

GPIO.B5 = 0;

}

else if(PIR1.B0 == 1)

{

GPIO.B5 = 1;

Delay_ms(50);

GPIO.B5 = 0;

}

else

{

}


PIR1 = 0;

INTCON = 0b11001000;

}


void init(void)

{

// Setup chip here

GPIO = 0;

TRISIO = 0x01;

CMCON0 = 0x07;

ANSEL = 0;


T1CON = 0b00110001;

TMR1H = 0;

TMR1L = 0;


IOC = 0x01;

PIR1 = 0;

PIE1 = 0x01; // Enable Timer1 overflow interrupt

PIR1 = 0x00; // Initially set flag to zero.

INTCON = 0b11001000; // Enable global and GP interrupts. flags = 0

}


void main() {

init();

while(1)

{

// Run main code here.

}

}