Mohamed Slama
Member level 4
- Joined
- Nov 8, 2013
- Messages
- 72
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 6
- Activity points
- 443
hello everybody
this code is a part of frequency counter code but i cant under stand these
lines (if (--tmr0_cnt==0)) and tmr0_cnt==0 initialized by 100
this code is a part of frequency counter code but i cant under stand these
lines (if (--tmr0_cnt==0)) and tmr0_cnt==0 initialized by 100
Code:
void interrupt()
{
if(intcon.f2==1) //if timer0 is overlfowed
{
if(--tmr0_cnt==100) //decrement and check tmr0_cnt until zer0 which means a second
{
intcon.f7=0; t1con.f0=0; //stop counting and global interrupts
flag=1; //set flag
}
intcon.f2=0; //reset timer0 flag
tmr0=98; //Timer0 starts counting from 98 again
}
if(pir1.f0==1) //if timer1 is overlfowed
{
OverNumb++; //increment number of overflow
pir1.f0=0; //reset timer1 flag
}
}