Does anyone have a formula for finding the time in seconds from TIMER0 on PIC16. I know my frequency, prescaler, and number of cycles (overflow and normal)... I can't connect the dots properly -.-
Tags:
Isn't it
Time = 256 * prescaler * number of cycles / (frequency)? And then you add (number of cycles taken up by your interrupt code) / (frequency) while the timer is inactive.
TIMER0 maxes out at 255 so unless you're measuring milliseconds it won't be very useful. Usually you look at the number of overflows (which you can track in your ISR because an overflow will cause an interrupt). At 1:256 prescaler on the 10MHz clock TIMER0 will overflow ~38 times per second
© 2024 Created by PML. Powered by