Polling T0IF Doubt

Status
Not open for further replies.

Suraj143

Active Member
When polling TMR0 we waiting until T0IF sets.My question is if T0IF sets will it halts the TMR0 increment?Or will it increment normally from 00h?

Will the same thing happens when use interrupts?
Means when T0IF sets it will goto ISR & if we not clear the T0IF bit will TMR0 increment?
 
The timer continues counting constantly unless you write code to stop it.
 
If you don't clear T0IF before you return from the ISR, the interrupt will happen again immediately.

If you are polling T0IF, you can also get a problem if you never clear it.
 
The interrupt will happen again immediately before returning from the ISR? I thought if the flag bit isn't cleared, the next interrupt will never happen again?

Suraj143,
The timer will still continue running until you stop it. The main reason of the bit flag is set with interrupt is because there can be more than one interrupt, so this flag bit is to indicate which interrupt has occurred.
 
The interrupt will happen again immediately before returning from the ISR? I thought if the flag bit isn't cleared, the next interrupt will never happen again?

It's a level triggered interrupt, as long as the interrupt flag is set, an interrupt will be generated.
 
Last edited:
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…