I am programming a PIC18F67K22 and I've set it to use a 16X4Mhz Internal RC oscillator with PLL enabled.
- High level interrupt on
TIMER0
overflow - I am using MCC18 compiler.
So how to set TIMER0
to give an interrupt at every second?
interruptsmicrocontrollerpictimer
I am programming a PIC18F67K22 and I've set it to use a 16X4Mhz Internal RC oscillator with PLL enabled.
TIMER0
overflow So how to set TIMER0
to give an interrupt at every second?
Best Answer
The
TIMER0
is a 16bits timer, so to set to interrupt every 1 second you need to set:Prescaler @ 16
TMR0 Preload @ 3036
The equation:
$$T = \left(\frac{4}{Fosc}\right) \cdot Presc \cdot (Resolution - Preload)$$
Where:
Sample code: