PDA

View Full Version : Is there a function that counts how many ms since start?



f18viper
- 6th December 2009, 18:10
Hello!

I'm coding up an alarm clock and I was trying to find a nice way of doing software debugging that wouldn't hold up the cpu. I have 8 7 segment leds and if i do any kind of delay i'm sure i'd see the display blinking.

What i want to do is whenever someone presses a button (time set or what-have-you) the time of the first press is stored (in mS). If another press within a designated timing constant, that press is disregarded.

Arduino has this function called millis, that gives you mS since start of the program, and I was wondering if pbpro had anything similar. I did dig through the green book and google and couldn't find anything.

Thanks for your time!
-Paul

rsocor01
- 7th December 2009, 16:35
Hi F18viper,

In PBP there is no such a function that counts the ms that I'm aware of. What you can do is set a TIMERx interrupt and keep track of the time this way. You can place a counter in the interrupt routine and know how many times the interrupt routine has been visited.

Robert