LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Loop Time

Hi,
 
I am trying to make a simple vi that every n seconds does an action.
Thus, i want to monitor the time, and when te specified seconds are elapsed, the program takes action.
Can somebody tell me how to program it, with the CPU usage in mind!!!
 
Thank you very much,
Jeroen
 
 
0 Kudos
Message 1 of 7
(3,646 Views)
Try the Timed Loop structure.
0 Kudos
Message 2 of 7
(3,644 Views)
    If you want the period to vary dinamically you can do this sending the value to a "period" node on the right side of the timed loop.
Paul
Mechatronic engineer
Lima-Perú
0 Kudos
Message 3 of 7
(3,628 Views)

You can use

-the "Wait until Next ms Multiple" but not the "Wait ms" (see Labview help for the difference)

-A event structure with a timeout.

 -A timed Loop.

0 Kudos
Message 4 of 7
(3,626 Views)
Hi!
   What level of accuracy do you need? If you loosely need to execute task each second, use (as said above) "wait until next ms multiple".  If you have to wait many seconds (say, some minutes, some hours), maybe it's better and cleaner to do your action when time elapsed since last execution is n minutes.  You can do this in a loop that periodically (each second, for example) get system time, and compute time elapsed from last iteration.

   If you have RealTime, just use timed loop.

   But please, clearify how loose is timing requirement!

graziano
0 Kudos
Message 5 of 7
(3,622 Views)
And for another option, just drop the Elapsed Time function into a loop and wire a case statement to the Time Has Elapsed output.
0 Kudos
Message 6 of 7
(3,618 Views)
Thanks for all the reply's!!!!
 
Well, i have a certain begin value(temperature), that i want substract with a value, each n seconds. The user or program can change the time, because it depends on the diffrent condition.
Thus, you can see it as a simulation. You have a certain temperature in a chamber, you left the door opened, so you can change the time of my program to calculate the temperature after n seconds.
I think this application isn't time critical, but if it was, i can use the time loop sturcture.
So il will post my program as soon i am ready with it.
 
Thanks,
Jeroen
 
0 Kudos
Message 7 of 7
(3,564 Views)