Okay, See if I learned anything.
OSC 20
20 mhz / 4 = 5 mhz
1 second / 5,000,000 = 0.0000002
Each tick is 0.0000002 seconds
So, I would need 50,000 ticks to make it fire 100 times per second.
Since the timer counts up to 65535 and we roll over I would do this....
65,535 - 50,000 = 15535
Preload the timer with 15535 then
0.0000002 x 50,000 = 0.01
So the Timer would fire every 100 times per second
Why then do I have to preload the timer with 15543 to make it dead on? Is this just a difference in osc frequency.
Bookmarks