LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use two Case while loops inside of a case structure

I have a case structue (1,,2,3). Inside of case 1, I have two while loops. Eache while loop has its own condition. I want the case structure to go from case 1 to case 2 when any of these two condition is true. How should I link the two conditions? Thanks
0 Kudos
Message 1 of 4
(2,954 Views)
Dataflow dictates that both while loops must stop in order to get out of the current case. Of course now you have to ask yourself why you even need two while loops. Can't you combine the two into one loop? Do they need to run a different rates?

Anyway, you would set both loops to "stop if true", then use a logical OR of the two conditions in each loop (probably one condition directly and the condition from the other loop via a local variable).

In any case, you cannot go directly from one case to the other (this is not a sequence structure!). You must e.g. place the desired case condition in a shift register so it is available in the next iteration.

Maybe you could attach a simple version of your code. There might be a better solution.
0 Kudos
Message 2 of 4
(2,947 Views)
Hi aurelia,

You may use state-machine structure for your requirement.
Attached is just a quick reference 🙂

Cheers!
Ian F
Since LabVIEW 5.1... 7.1.1... 2009, 2010, 2014
依恩与LabVIEW
LVVILIB.blogspot.com
0 Kudos
Message 3 of 4
(2,945 Views)
Thank you. Attached is the code. I am refering to case 0 of the big case structure, False of the case structure inside, and 0 of the case structure inside of the false. There I have two while loops. One runs from the Daq board and the other one runs from the RS232 serial port. If I put these two programs in a single while loop, the time displayed is very slow. If they are in two loops, the time is running normal. This is why i need to be able to stop one or the other while loop and then the program will automatically go to case structure 1. Thanks
0 Kudos
Message 4 of 4
(2,910 Views)