LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

For Loop and While loop in parallel

Hi,

 

I was wanting to use a PID inside a while loop in parallel with a For loop that contains a sequence structure in it. The problem is that whenever the for loop executes into the sequence structure, the pid in the while loop stops. I was wondering if there is a way I can incorporate parallel loops for this, so that the while loop will continue to run as the for loop with the flat sequence structure does.

 

Thank you

0 Kudos
Message 1 of 3
(1,068 Views)

This is weird code.  You have a For Loop with a sequence structure inside.  Frame 1 reads (using as much CPU time as it can) and sets four controls using some strange combination of strings and spaces.  When you push the button labeled "Start", this stops the loop.  [Ever heard about an Event Structure, which uses approximately 0% of the CPU time, while your loop using approximately 100%)?]

 

Frame 2 does some process and then stops,  There's a For Loop with 1 wired to the number of repetitions.  ???  There's another Stop 4 control ORed to the Error Line (so True if an Error or Stop 4 is pressed), but this isn't wired to anything.

 

Frame 3 takes A/D readings from Mod1/ai0:4, putting 15 data points on a Chart.

 

Meanwhile, you have a While Loop that is supposed to run in parallel with this strange concoction that acquires Analog data from Mod1/ai3.  I must confess I don't understand what this code is supposed to do, nor why you are taking points one at a time, but it does appear that both the While and For loops are interested in Mod1/ai3.  Might cause a problem ...

 

Bob Schor

0 Kudos
Message 2 of 3
(1,051 Views)

To give you some background, this is for a Wind Tunnel application, and it does work, however I would like the PID controller to run throughout the test, but it stops once the second frame starts. I am thinking of switching to a state machine application, maybe this would be better. Is there any documentation on using state machine for DAQmx? and would it solve the intended problem?

 

Thank you

0 Kudos
Message 3 of 3
(1,018 Views)