LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Case Structure Nested in a For Loop

I have two pumps. I want one pump to be running and the other pump to be off. Then as soon as the first pump stops I want the other pump to start. I'd like this process to repeat as many times as I want. The code I have now uses a case structure inside a for loop. When the iteration is odd it is false and even is true this determines what case is carried out. Right now I have a code that can turn on one pump, stop it, and immediately start the second. However, after the second pump stops the first one does not start again. I've changed the number of iterations and I can't seem to get the process to continue. The program keeps running but the pumps stop doing anything. Attached is a file of my code as well as two image files (one showing true case and other showing false) of the same code.

Download All
0 Kudos
Message 1 of 2
(2,710 Views)

Your code has an inner while loop that checks for the status of the pump.  Since you set up a target volume before the while loops start, I assume that it is what the status checks to determine when to stop the while loop.

 

When the the second iteration ends, has the volume for the first pump changed at all?  If it is still the same, then the status is still at the target which means it will immediately stop after starting.  You may also want to put some small wait statements inside the inner while loops so that the status isn't checked as fast as the CPU will allow it to run eating up CPU cycles.

0 Kudos
Message 2 of 2
(2,695 Views)