06-08-2007 06:17 PM
06-08-2007 06:30 PM
06-08-2007 06:47 PM
06-11-2007 12:52 PM
I mean what you guessed- if the timer wraps around to 0 (after 2^32 ms). I decided to check if the second value is less than the first value and raise an error in that case. I thought about writing a sub-VI that would do the extra math in the case that the timer does wrap around but in my case I don't think it's necessary.
David
06-11-2007 01:08 PM
06-11-2007 01:16 PM
Hmm,
This is very intriguing - I had always used the "Get time in seconds" VI, as it does give you fractional seconds. But, running a few tests just now showed that I could really only get a precision of about 15ms, rather than the 1ms resolution I can get with the millisecond timer. Thanks for bringing up the subject guys!
Also, davey31415, I am not sure you really need to produce an error on rollover. Say we have a very cheap timer that rolls over from 99 back to 0 ms. If we read time1=95ms and time2= 3 ms, we can figure out that eight seconds have passed. The math is essentially T2-T1 + range or 3-95= -92, -92+100=8 [the number line is a zero-index array, so 0-99 is 100 points]. So, if T2-T1 is <0, then add 2^32ms.
Most likely there is a more elegant way to do it, but that's my thought.
06-11-2007 04:00 PM
That's great to know- never realized unsigned integer math worked out that way. Thanks!
David
06-11-2007 07:36 PM