From Art's Timer thread here:

https://www.picbasic.co.uk/forum/sho...978#post131978

Quote Originally Posted by Art View Post
Hi Guys,

...For the 20MHz example where the constant is 03B7h, it's the reverse of this:

FFFFh - 03B7h = C348h (49992 decimal),
49992 + 8 = 50000 (it must take eight instruction cycles to reload the timer)
50000 / 10000 = 5
5 x 4 = 20MHz

...Cheers, Art.
If I reverse these steps for a 16F1936 at 32MHz, I get this:

32 / 4 = 8
8 x 10000 = 80000
80000 - 8 = 79992


And that's where I block; 79992 is > 65535

What am I doing wrong?

I assume this is where the Prescaler comes into play, but I don't know how.


EDIT: So far, I have this for T1CON:

Code:
T1CON    = %01010100     ; Prescaler=1:1, TMR3ON.
'           bit 7-6 TMR1CS<1:0>: Timer1 Clock Source Select bits
'                   01 =Timer1 clock source is system clock (FOSC)
'           bit 5-4 T1CKPS<1:0>: Timer1 Input Clock Prescale Select bits
'                   01 = 1:2 Prescale value                                        
'           bit 3   T1OSCEN: LP Oscillator Enable Control bit
'                   0 = Dedicated Timer1 oscillator circuit disabled
'           bit 2   T1SYNC: Timer1 External Clock Input Synchronization Control bit
'                   1 = Do not synchronize external clock input
'           Unimplemented: Read as ‘0’
'           bit 0 TMR1ON: Timer1 On bit
'                   1 = Enables Timer1
I'm still looking how to use Prescaler in Art's formula.

(moved my post out of Art's thread)