PDA

View Full Version : Updating Timers



Charles Linquis
- 11th September 2008, 20:18
I use a timer interrupt and re-write TMR0 at the top of the routine. I don't stop the timer before I do the writes, and I have never noticed any problems. However, in many code examples, I see where people stop the timer before they write to it. The datasheet isn't clear as to if this is necessary or not.

Should I be stopping the timer before I write to it?

Darrel Taylor
- 11th September 2008, 20:33
For Timer0, no.

The reason for stopping the timer is so that the LowByte can't carry into the HighByte in the middle of reloading. But this only has an effect on 16-bit timers that are not in RD16 mode.

Timer0, when used as a 16-bit timer, is Always RD16. So the carry during reload doesn't matter.
<br>