I used TIMER1 in PIC12F675 with overflow interrupt and the time for over flow around 0.5 sec and in simulation its true
the code of overflow interrupt FUNCTION :
void interrupt int_tmr1(void) {
if((PIE1&(1<<0))&&(PIR1&(1<<0))) //TMR1 OVERFLOW CONDITION
{
GPIO^=(1<<0); //TOGGLE LED
PIR1&=~(1<<0); //CLEAR TMR1 INTERRUPT OVER FLOW FLAG
}
}
but if i want to increase the duration by editing in the interrupt function like that :
void interrupt int_tmr1(void)
{
if((PIE1&(1<<0))&&(PIR1&(1<<0))) //TMR1 OVERFLOW CONDITION
{
static unsigned char count=0;
if(count>10)
{
GPIO^=(1<<0); //TOGGLE LED
count=0;
}
else
{
count++;
}
PIR1&=~(1<<0); //CLEAR TMR1 INTERRUPT OVER FLOW FLAG
}
}
the required time is 5sec but in simulation the time is 6 sec what does that mean ?