Hello Shane,
I'm jumping in here with my couple of cents worth...
TMR3 trips an interrupt when it overflows. It's 16bits wide so it counts from 0 to 65535 and then overflows back to 0, tripping the interrupt. If you have the TMR3 prescaler set to 1:1 (which you have) the timer "ticks" at Fosc/4 or 5Mhz in the case of a 20MHz x-tal. 5MHz/65536=76.3Hz which is your interrupt frequency.
If you want it to interrupt at higher frequency all you need to do is preload TMR3 with a suitable value each time it interrupt. If you preload it with 51350 then you'll get an interrupt frequency of roughly 5Mhz/(65536-51350)=352Hz.
Remember that you have to load the timer each time it overflows, not just once. This is best done by stopping the timer and then ADD the preload value to the content of the timer registers, this way the interrupt latency is catered for.
Using TMR2 may be better since it interrupts when it matched PR2 and automatically resets so you don't need to preload in each interrupt.
With all that said, if you're already HAVE a timer interrupt (TMR1 in your case) why not use that. There's no reason you can't check your input AND keep time (if that's what you're doing) from within the same ISR. There's usually no need to have a separate timer for each and every task.
/Henrik.
Bookmarks