PIC Timer interrupt calculation
Posted: Wed May 25, 2022 4:55 pm
There seems to be an error in the Timer interrupt frequency calculation.
I created a small test program - using a pic16lf15313 running at 32MHz. I have a LED on a4 (with a current limiting resistor of course)
The Interrupt enable specifies a frequency of 1953Hz - but as can be seen from the check at the end - the frequency is ~8000Hz (actually it's its slightly > 8000 set check to 7800 - 8100 to light the LED!)
Modifying source to FOsc / 4 gives the same 'calculated' rate - and the correct rate in hardware.
Edit - it's probably just that fosc /hfintosc options shouldn't be offered?
Martin
I created a small test program - using a pic16lf15313 running at 32MHz. I have a LED on a4 (with a current limiting resistor of course)
The Interrupt enable specifies a frequency of 1953Hz - but as can be seen from the check at the end - the frequency is ~8000Hz (actually it's its slightly > 8000 set check to 7800 - 8100 to light the LED!)
Modifying source to FOsc / 4 gives the same 'calculated' rate - and the correct rate in hardware.
Edit - it's probably just that fosc /hfintosc options shouldn't be offered?
Martin