Timer 2 Calculator
Posted: Tue Mar 10, 2020 7:09 pm
I prefer using timer 2 over other timers as it allows much more precise control.
That is because you have a Postscaler, Prescaler and a rollover value to deal with.
While having more options gives you much better flexibility, it's downfall is its more complicated to calculate correct values to give desired frequency.
For example, I'm after an interrupt hat gives me exactly 60Hz, how do I determine the correct Postscaler, Prescaler and Rollover values?
That is where the attached Excel sheet comes in extremely handy.
Just enter the oscillator frequency and required interrupt frequency and the Excel sheet gives all the answers! As you can see if maximum prescaler is only 16 then the nearest value to 60 will be 75Hz.
How about I would like to know all the whole frequency values?
Not a problem, excel sheet can do that as well: Hope this helps you as much as it has helped me.
The Excel sheet was modified with Libra Office, but I see no reason why it won't work with excel.
Note: After entering frequency you must select the drop-down and what maximum Prescaler you have, before results are shown.
That is because you have a Postscaler, Prescaler and a rollover value to deal with.
While having more options gives you much better flexibility, it's downfall is its more complicated to calculate correct values to give desired frequency.
For example, I'm after an interrupt hat gives me exactly 60Hz, how do I determine the correct Postscaler, Prescaler and Rollover values?
That is where the attached Excel sheet comes in extremely handy.
Just enter the oscillator frequency and required interrupt frequency and the Excel sheet gives all the answers! As you can see if maximum prescaler is only 16 then the nearest value to 60 will be 75Hz.
How about I would like to know all the whole frequency values?
Not a problem, excel sheet can do that as well: Hope this helps you as much as it has helped me.
The Excel sheet was modified with Libra Office, but I see no reason why it won't work with excel.
Note: After entering frequency you must select the drop-down and what maximum Prescaler you have, before results are shown.