Wait ms Timer Multiple returning inaccurate timer value 
Author Message
 Wait ms Timer Multiple returning inaccurate timer value

There are a couple of things going on that affect your results.
1. Windows is not a real-time operating system.  As it multi-tasks,
you have little control over when it gives time to your application.
Loop times may vary depending on what else Windows decides during that
iteration.  Especially when doing file I/O: if your disk is busy, a
loop interation may take longer.  Windows may also be doing some disk
buffering, so occasionally a loop interation may take much longer than
usual as the buffered data from multiple loop interations gets written
to disk.
2. Wait Until Next ms Multiple doesn't garuntee equal loop times.
With the millisecond multiple input set to 1000, if one iteration
starts with the PC's clock at xx:xx:xx.001, Wait Until Next ms
Multiple will wait 0.999 seconds.  If an iteration starts with the
PC's clock at xx:xx:xx.999, Wait Until Next ms Multiple will wait
0.001 seconds.
3. In your main loop, you check to see if the millisecond timer value
* 60 equals the desired Length of Data Collection.  If your loop
doesn't execute every millisecond, you may miss the equals case and
then your loop won't stop.  You should check >= rather than just =.


Mon, 12 Dec 2005 03:24:06 GMT  
 Wait ms Timer Multiple returning inaccurate timer value

Quote:
> Agree completely but why can't LV provide access to the windows multimedia
> timer like LabWindows does? Provide me a timer, I can start/stop by changing
> its properties and run that in a separate thread. Obviously if I have
> another thread starving this timer thread, it won't help much but using
> multi-media timer, I have seen very good results on a windows2000 machine.
> Now win95/98 and derivatives are all other story.

This is equivalent to making a separate loop, preferably in a VI with an
elevated priority.  Make the loop have a wait ms or occurrence with a
timeout value.

This is different from having a function callback on a windows timer,
but it is similar.  LV has a timer thread that is tied into the same
multimedia timer.  That thread provokes timeouts on occurrences and
reschedules code that has waited the appropriate amount of time based
upon wait ms.  Problem is, being scheduled and running are two different
things.  If another loop is running at that point, it will get it in the
way if they happen to share the same execution system.  If the waking
task is higher priority, the OS should respond pretty quickly to switch
out the threads.

Greg McKaskle



Tue, 13 Dec 2005 12:25:20 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Using timer 2 instead of timer 1

2. Self-running timer display while waiting for input

3. Multiple Timers, Need to use all of them, in LabVIEW

4. variable as timer value and palette size??

5. value of timer?

6. asm source for 1 ms resolution timer

7. asm source for 1 ms resolution timer

8. return multiple values from an awk function?

9. ???Eiffel idiom for multiple return values???

10. Tuples, iterators, and multiple return values in Eiffel?

11. multiple values in a return from function

12. Multiple return values

 

 
Powered by phpBB® Forum Software