LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sequential Timing Loop

Solved!
Go to solution

I have attached an image of a VI that I have created to try to debug what I am calling a sequential timing structure. I am using the Elapsed Time express VIs in the flat sequence structures with auto-reset enabled. I have indicators for the two elapsed times. What happes is the first loop will execure and not stop until the elapsed time reaches 5 seconds, then the second loop will start and execute until the elapsed time on the second elapsed timer reaches 5 seconds. What I expect to happen is the outer while loop will return execution to the first flat sequence while loop, the timer will reset, and the aforementioned sequence will start again. What actually happens is that the 'Time has Elapsed' in the first elapsed timer remains true and the loop imediatly exits. The second timer does reset and counts as expected. I am sure this is a simple mistake I am making, but some guidance would be refreshing. 

 

Timing Loop.png 

0 Kudos
Message 1 of 4
(4,468 Views)

Wire a "equal zero" to the iteration terminal and then wire the boolean output of it to the "reset" input of your express VI.

 

(Of course I assume that your real code has more to it. Your current example is relatively clumsy. All you probably need is a proper state machine instead of all that duplicate code, CPU burner loops, sequences, and value property mess. ;))

Message Edited by altenbach on 11-12-2009 05:21 PM
0 Kudos
Message 2 of 4
(4,455 Views)
Solution
Accepted by topic author Plato

Here is what happens in your case:

 

Both express VIs are set to autoreset, meaning when the time of the first loops has elapsed, it resets the timer and starts counting again. Five seconds later the second loop stops and the first loop starts again. By now, more than 5 seconds have elapsed after it got reset, so the time has again elapsed. 

Message 3 of 4
(4,446 Views)
Thanks altenbach. Your solution makes good sense. You are correct that this is a poorly architected VI, I was simply trying to see how to use these express VIs to create a "duty cycle machine." The ultimate intent is to implement the structure into a state machine that will be used to control some lab equipment. Cheers!
0 Kudos
Message 4 of 4
(4,412 Views)