Timer1 usage in PIC18F252
Been diviing into the description of the use of the interrupts for the 18F252 device and want to test out my understanding relative to the relationship between the prescaler and 8/16 bit registers of the timer.
If I'm using a 4Mhz oscillator and an internal clock for the Timer then my effective frequency going to the 8 or 16 bit counter is either:
1 Mhz for a Prescale value of 1
500 Khz for a prscale value of 2
etc....
Then this frequency is fed into the counter and when it overflows an interrupt is generated.
Correct?
So if I want an interrupt every 0.5 seconds I could use a prescale of 8 giving me a frequency of 125khz (8us period) and preload the 16bit register with 3036 (decimal)
I reached this figure by dividing 0.5 sec by 8 us and getting 62500 pulses required to overflow the 16bit counter. With no preload, the counter would take 65,536 counts to overflow so I would preload it with 65536-62500
Correct?
The other thing I'm not sure about is the ability to configure the timer for 16 bit reads and writes. I still need to read TMR1L and TMR1H separately... don't I?
I'm sure I'll have more questions when I attempt to program this later on this weekend.
thanks...Chris
Preload Register on service
I'm also assuming that I will need to reload the TMR1H/L register as I exit the interrupt service routine. Correct?