-
Newbie Question - Timers
I just purchase PBP and am looking over the manual along with the microchip datasheet for the 16F876. I am creating a project that will need a timer to calculate an elapsed time from 250 ms to 5 seconds. It looks like I could do this by polling the counter on the internal counter modules. But I don't see where this is supported in the manual, but did find references to TMR on this forum.
I'd rather not use interupts if I can avoid it. I don't need micro-second resolution, milli-second will do.
Can I poll the timer module using PBP? Where is this mentioned in the manual? How is this configured?
Thanks for any help.
- Joe
-
JOE,
The datasheet is your best friend in this case -
If you are using TMR0, you can poll like this:
Code:
loop:
if INTCON.2 = 0 then loop
'deal with overflow here
I have a clock example here that also shows polling of TMR0 for timing issues.
http://www.picbasic.co.uk/forum/showthread.php?t=2129
Also see Melanie's Olymic Timer here
http://www.picbasic.co.uk/forum/showthread.php?t=632
and Darrel's timer here
http://www.picbasic.co.uk/forum/showthread.php?t=190
for ideas.
-
Thanks Paul, I'll have a look at these resources. I'm sure they will cover what I need to do.
I wonder why this isn't in the PBP manual?
Thanks again,
Joe.