LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

code flow order

I have three for loops in my code and I want then to run in order.  Do I have to do anything to make the first run first, then the second, then the third?  In C one simply writes the code in the order it will run.  How is that done here?
0 Kudos
Message 1 of 11
(3,172 Views)
DATAFLOW! Wire data from loop 1 to loop 2 and data from loop 2 to loop 3. You should be using error in/error out connections in your VIs and that's the easiest way but any data will do. Understanding dataflow is basic to understanding how LabvIEW works. You might want to check into available classes or tutorials.
0 Kudos
Message 2 of 11
(3,166 Views)
Understanding how to do this is at the heart of using a data-flow language like Labview.

You need to arrange things so that the second to run requires a output from the first, and so the third requires an output from the second.

You can use error clusters to do this or if you want just wire ANY output from the first FOR loop into the second. You don't even need to do anything WITH the output, it just needs to be wired to the FOR loop.
0 Kudos
Message 3 of 11
(3,163 Views)
An example of what Dennis and gwd are describing:



[edit] Reading comprehension is HARD.  Here is an example with for loops.

Message Edited by jasonhill on 05-12-2006 02:23 PM

Download All
0 Kudos
Message 4 of 11
(3,159 Views)
For a better understanding, run the interactive tutorial "Introduction to LabVIEW" found on http://www.ni.com/labview/demos.htm
 
Try to find the answer to quiz #1 on slide 11. 😄
0 Kudos
Message 5 of 11
(3,147 Views)
I have one output comming from each for loop.  And when the first loop is running I want it's output to go to a DAQmx write block.  Then when the second for loop is going I want the output from it to go to the DAQmx write block, and when the third loop is going I want the output from it to go to the DAQmx write block.  I can not connect these three lines together.  My best idea is to run it through a case structure.  But I do not know how to make the case structure know when which for loop is running.  Do you  have any ideas?
 
thanks
0 Kudos
Message 6 of 11
(3,123 Views)
Now you have to realize there isn't going to BE any output from any of the loops until the loop is done running. If your idea is, for example, to output one of several waveforms this isn't going to do it. You may need to rethink your solution from the beginning.

You could try to explain the whole problem here...or maybe in the course of trying to explain the whole problem you will see a way to the solution.


0 Kudos
Message 7 of 11
(3,102 Views)
You can still use the dataflow. If you generate data in a for-loop you want to write to a DAQmx write vi, you just can wire them. As jasonhill did in his examples.
Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 8 of 11
(3,086 Views)
I don't think you want a case structure.  I think you want a queue.  A producer / consumer strucutre.  Where two loops are producing data and put it in the queue and the third loop is writing the queued data to the DAQmx.
0 Kudos
Message 9 of 11
(3,064 Views)

Doesn't the for loop output on each iteration?  That is all I want.  Each iteration I want a value outputed to the DAQ.  However, during the first loops iterations I want that value to come from it, during the second it, and durring the third it.  I know I can get the the value out of the loop, I do not know how to choose which loop to take the value from.  Basically, I just want a way to tell which of the three loops are running.

Does this make sence?  Am I way off here?

0 Kudos
Message 10 of 11
(3,045 Views)