LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

I need to wait 30 seconds and then perform a task!

Does anyone know how I can go about programming my vi to wait 30 seconds in between taking data points, without using the wait function? I have two loops so I can't use the wait funtion or else it is impossible to stop the vi. So I am trying to calculate rate of penetration - and to do that I have to take two data points 30 seconds apart and then divide by elapsed time. I am having difficulties doing this. Thanks!
0 Kudos
Message 1 of 10
(3,571 Views)
I call this technique as "incremental wait/delay". Basically, your wait is always small (less than half second), using a variable or shif-register to keep track the total elapsed or wait time since last action. When the wait time is fullfilled, then perform the desired action.

The implementation can be different, here is a simple one.

-Joe
0 Kudos
Message 2 of 10
(3,571 Views)
I would like to check out the vi but I only have labview 7 (boo hoo).....can you please convert it?
0 Kudos
Message 3 of 10
(3,571 Views)
0 Kudos
Message 4 of 10
(3,571 Views)
There are so many loops that I don't understand what is going on and where I put my calucations when I have the second data point after 30 seconds has gone by.
0 Kudos
Message 5 of 10
(3,571 Views)
Also - I have another big while loop going on at the same time. Will there be conflict with both of them running, and can I create a local variable on the other loop for it to work in this one? Thanks!
0 Kudos
Message 6 of 10
(3,571 Views)
sorry one last thing -- does the blue wire on the inner-innermost loop need to be connected for the true case as well? isn't that how the numbers are passed on to the right, blue shift register?
0 Kudos
Message 7 of 10
(3,571 Views)
1. the code should be inside the loop where the long wait is happending.
2. i guess you can run the code in the separate loop, but then you need make sure it is synched and also make sure the loop will exit when you exit your application.
in the demo vi, the loop goes on forever.
3. in labview 6 and above, if the wire is not wired, a default value is supplied, in this case, 0, which is what the shifter righer need in that case.

-Joe
0 Kudos
Message 8 of 10
(3,571 Views)
Hi Joe - It works and I put the calculations inside the "next step" case. However, I have to press the stop button a couple times for it to stop. Like I said earlier, in number 2, the big, other loop has the stop button. Any suggestions on getting the stop button to work for both immediatley?
0 Kudos
Message 9 of 10
(3,571 Views)
Glad to hear it worked.
check the image below, use an indicator and its local variable. do not use the local variable of the button stop. Initialize the indicator (real stop) before the loops starts.

-Joe
0 Kudos
Message 10 of 10
(3,571 Views)