PDA

View Full Version : Newbie Question - Timers



JoeEvert
- 23rd September 2006, 05:49
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

paul borgmeier
- 23rd September 2006, 12:15
JOE,

The datasheet is your best friend in this case -

If you are using TMR0, you can poll like this:


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.

JoeEvert
- 23rd September 2006, 16:42
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.