![]() |
Tracking Elapsed Time
Our team is getting better at programming using MPLAB and I had a question:
1. What is the best way to track elapsed time? For example, the the main loop running on the RC is fast enough to loop (3) times each time the IR board receives an input then sends out a pulse. We would like to create a timer and ignore any other pulses from the IR board for a 500ms window to prevent processing the same signal (3) times. I wasn't sure if the RC had an internal clock which could be read and stored into a variable. Good Luck! TEAM #1711 Traverse City, MI |
Re: Tracking Elapsed Time
The PIC has several onboard hardware timers you could use for this, but I think just counting passes through the main loop would be much simpler for this application.
If you really want to use a hardware timer for this, look at this IFI whitepaper. A polled timer should be good enough for your purposes, so you'd setup the timer in your initialization, then you'd start it and pre-load the correct values when you saw a pulse. as long as the interrupt flag is 0, it hasn't timed out and you should ignore pulses. |
Re: Tracking Elapsed Time
Quote:
See http://www.chiefdelphi.com/forums/sh...ad.php?t=54948 for a previous discussion on the topic. |
Re: Tracking Elapsed Time
Use the same tpe of system the NHRA uses for ETs. they can handle a 26-foot car at 330 MPH right down to thousanths of a second
|
Re: Tracking Elapsed Time
Quote:
Code:
unsigned int loop_counter; |
| All times are GMT -5. The time now is 13:47. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi