Host Engineering Forum

General Category => Do-more CPUs and Do-more Designer Software => Topic started by: davidbgtx on December 14, 2016, 04:16:42 PM

Title: Most accurate timing
Post by: davidbgtx on December 14, 2016, 04:16:42 PM
What would be the most accurate "thing" to use for timing, count the 50ms bit? just use a timer? In ThinkNDo I was told to count the rolling msec counter as it was more accurate than using a timer.  Calculating a rate - weight change from a scale for 5 sec and sometimes 10 sec   
Title: Re: Most accurate timing
Post by: BobO on December 14, 2016, 05:05:01 PM
Most precise? TICKus() in MATH.
Title: Re: Most accurate timing
Post by: davidbgtx on December 14, 2016, 05:16:42 PM
thanks
Title: Re: Most accurate timing
Post by: BobO on December 14, 2016, 05:23:51 PM
Normal timers are 1ms resolution. TICKus() gives you access to the raw microsecond timer that we use internally.
Title: Re: Most accurate timing
Post by: davidbgtx on December 14, 2016, 05:55:52 PM
So if I triggered a math calculation from a done bit of a TMR with a preset of 5 Sec vs triggering from Tickus() of 5000000, it would be just as accurate either way? I don't need the resolution, I just need it to be the 5 sec every time, regardless if program scan time is varying slightly. Or if the TMR done bit is actually 5.001 sec, will it be 5.001 sec every time? Does that make any sense?
Title: Re: Most accurate timing
Post by: BobO on December 14, 2016, 07:07:06 PM
They are both scan bound, and driven by the same underlying timebase, so yes.

We have some wonderful hardware-based timer options in the new hardware due out early next year, which will allow you to trigger interrupt routines with microsecond accuracy and about 5us of latency. For now, software-based timers at scan resolution are the best you can do.
Title: Re: Most accurate timing
Post by: davidbgtx on December 15, 2016, 04:54:17 AM
Cool!
and Thanks for your help