#include <htc.h>
#include <math.h>
__CONFIG(1,XT);
int count=0;
int time=0;
unsigned char shad;
void main(void)
{
TRISC=0x00;
T0CON=0b11000111;
TMR0IE=1; //Enable TIMER0 Interrupt
PEIE=1; //Enable Peripheral Interrupt
GIE=1; //Enable INTs globally
while(1);
{ RC2=shad;
}
}
//Main Interrupt Service Routine (ISR)
void interrupt ISR()
{
//Check if it is TMR0 Overflow ISR
if(TMR0IE && TMR0IF)
{
time++;
if (time==10)
{
count++;
if (count%2==0)
{
shad=0;
}
if (count%2==1)
{
shad=1;
}
if (count==6000)
{
count=1;
}
time=0;
}//Clear Flag
TMR0IF=0;
}
}