LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

execution of case statement stops data update

In the attached vi, I am querrying 3 different sensors for their values.  (N2 Indicated Flow, O2 Indicated Flow and He concentration).  I want to be able to display these constantly updated values on the front panel.  Then, when I press Save Data, I want to be able to save the next n values, at the desired interval.  The problem is that whenever I press the Save Data button, all three of the sensor inputs lock up at the last value prior to pressing the save data button.  The same value (the value shown on each of the sensors the last iteration prior to saving) is saved to file.  The data is not updating as long as the while loop in the case structure is iterating.  As soon as the last iteration is done, the displays resume wiht live, changing data.  HELP!!!
0 Kudos
Message 1 of 2
(2,390 Views)
You've got a major design flaw. When you enable Save Data, you are passing a loop count number to the for loop. The for loop will execute that number of times (at a 1 second interval) before it finishes and returns to the main program and gets another set of measurments. With the defaults you have, the for loop will take 2 minutes to run. Since the for loop is in the same while loop as the DAQ, it does not run in parallel. You can make code execute in parallel by using 2 separate while loops. You can pass data via local variables or a queue. You can also replace the for loop with different logic. For example, when the save data goes true, you can set a time and write it to a shift register and then with each iteration of the main while loop, decide whether to log if the current time is greater than start time plus the measurement interval.
0 Kudos
Message 2 of 2
(2,382 Views)