With my little knowledge on timers I've started a project which is going to make use of a timer instead a delay loops. I just want to double check on my thinking before I write the code and then wonder why its not working
From my understanding or timers and prescalers:
a 4Mhz PIC with a:
Timer0 with prescaler of 1:256 will increment the counter ever 65ms. ie If I I increment a counter everytime it overflows, the max time I can get out of a 8 bit variable is 256 * 65ms = 16.6s
Timer1 with prescaler of 1:8 will increment the counter every 524ms. Again the max time I can get using a 8 bit variable is 134s
So for example for a 60 second time I could use Timer0 with 1:8 prescaler with a 8 bit variable. When the variable reaches 114 decimal then 60 secs has passed. Give or take a few seconds, its not critical.
Does this sound correct?
From my understanding or timers and prescalers:
a 4Mhz PIC with a:
Timer0 with prescaler of 1:256 will increment the counter ever 65ms. ie If I I increment a counter everytime it overflows, the max time I can get out of a 8 bit variable is 256 * 65ms = 16.6s
Timer1 with prescaler of 1:8 will increment the counter every 524ms. Again the max time I can get using a 8 bit variable is 134s
So for example for a 60 second time I could use Timer0 with 1:8 prescaler with a 8 bit variable. When the variable reaches 114 decimal then 60 secs has passed. Give or take a few seconds, its not critical.
Does this sound correct?
Last edited: