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!
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.
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.
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!
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?
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.
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?
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.