Quote Originally Posted by Adrian View Post
I have used Darrel's interrupts to generate a 1KHz pulse stream. As I'm using TOGGLE the interrupts needs to be at a 2KHz rate. Using PicMultiCalc with 7 instructions and 20MHz oscillator this gives Timer reload as 63043. Using this I get 959 Hz. I have to load 63150 to get about 1,000Hz. 107 ticks seems a long way out to me. Can someone please tell me why the great discrepancy and/or what I'm doing wrong. Many thanks
Adrian
Looks about right to me...
20Mhz oscillator = 5Mhz instruction rate/Timer increment rate
5,000,000 / ( 65536-63043) = 2005 Hz
5,000,000 / ( 65536-63150) = 2095 Hz

Neither number above compensates for the 7 instructions, but the idea is the same.
You've got the numbers right...or at least it looks like it.