Quote Originally Posted by Adrian View Post
Thanks Skimask

The reload criteria seem to be right, as you also concur, but for the life of me I still can't understand why it is over 100 ticks out. I have measured the frequency both on a counter and on a scope so I think we can be pretty sure that's OK. I hope I can solve this rather than it just goes down as one of life's little mysteries.....!
Thanks

Adrian
What do you mean by '100 ticks out'?
Do you mean that it's over 100 ticks off of what you calculated to be the reload value?
If that's the case, you might be forgetting about the overhead of the program itself (2 cycles to jump in, 2 cycles out, a couple of cycles to reload the timer itself, and so on)...
Or something different?
Maybe your 20Mhz is off?