Brutis,
Had you visioned using PBP interrupts, "Instant Interrupts," ASM interrupts, or polling for TMR1 overflows? This might help people help you.
Paul Borgmeier
Salt Lake City, Utah
USA
Brutis,
Had you visioned using PBP interrupts, "Instant Interrupts," ASM interrupts, or polling for TMR1 overflows? This might help people help you.
Paul Borgmeier
Salt Lake City, Utah
USA
Hi Paul,
Thanks for the reply, I'm using the timer1 module in PBP. But I cannot seem to get a 1 second timer from this. The most I can get is 5.24 ms before the interrupt flag gets set. Do you know how I can get a 1 second timer form TMR1?
Regards,
Brutis
Have a look at Olympic Timer (search the forum) to give you an idea of how TMR1 could be used to increment variables to count whatever time period you require.
Hi Melanie,
Thanks for the link. Did not fully understand all the code. Would you happen to know the simplist way to acheive a 1 second rate using the timer1. I'm using a 0.5 second rate now but I need more time to execute my code. 1 second would be great before the flag gets set. Any idea how to do this.
Thanks
Regards,
Brutis.
Datasheet! *sigh*
Timer1 ticks every 1uS @ 4MHz.
It's 16 bits wide, therefore with a 4MHz clock will time 65.536mS between each Flag.
Using the 1:8 prescaler your maximum time is 8*65.536mS=524.288mS
So unless Microchip has shoved hardware into your PIC that mine doesn't have, the answer is NO, Timer1 will NEVER tick 1 second @ 4MHz.
You can always use a Bit Variable as a Flag... If BitFlag=0 and Timer1Flag then half a second has elapsed - so Set the BitFlag. If BitFlag=1 and Timer1Flag then one second has elapsed, so reset the BitFlag and start over for a new Second.
Homework: What has Timer2 got that Timer1 doesn't have?
Timer2 has a prescaler and a postscaler. Am I right Melanie, am I right??
Yup, you're right... Homework Part Deux: Which now means what's the maximum Time you can let Timer2 run for at 4MHz with all the prescalers and postscalers enabled?
Bookmarks