LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

while loop and sequence strucure

Solved!
Go to solution

Hi everyone.
I post here cause i didnt find an answer yet on this forum.
I would like to know if there is anyway to trigger a while loop with a sequence structure.
I made an exemple for a better understanding.

My program is a lot harder but it summarizes what i need to do.
Thanks for reading

0 Kudos
Message 1 of 16
(3,312 Views)

@Bit0q wrote:

Hi everyone.
I post here cause i didnt find an answer yet on this forum.
I would like to know if there is anyway to trigger a while loop with a sequence structure.
I made an exemple for a better understanding.

My program is a lot harder but it summarizes what i need to do.
Thanks for reading


Maybe just stick it inside the sequence structure?

 

I don't like where that VI is going, though.  It screams "I have no concept of data flow!"

 

This link has super-helpful tutorial links to help you out.  🙂

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 2 of 16
(3,296 Views)

Oh, and - my bad - if you tell us what you're trying to achieve, we might be able to help you find a better solution. 🙂

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 3 of 16
(3,294 Views)

The answer is "Yes, it is possible", but it would surprise me if anyone would say it is a good idea!  Starting and stopping While Loops inside another loop in an asynchronous manner is just begging for trouble.

 

LabVIEW is a Data Flow language.  If you don't know what that means, you really need to take the introductory LabVIEW Tutorials.

 

LabVIEW also inherently supports multiple independent processes running in parallel.  There are a variety of methods used to communicate between these parallel processes, for example, telling an independently-running While loop when to stop.  However, the design of such programs is best done with a clear description of the program requirements first (the well-known, but little-followed, rule to Write the Documentation First).

 

Incidentally, most LabVIEW programmers connect and sequence code using the Error Line, and rarely use Frames/Sequence Structures.

 

Bob Schor

0 Kudos
Message 4 of 16
(3,288 Views)

Billko and I demonstrate "working asynchronously and in parallel", but since we both said basically the same thing, you know it is probably true ...

 

BS

0 Kudos
Message 5 of 16
(3,282 Views)

Bit0q wrote:

My program is a lot harder but it summarizes what i need to do.


What is the meaning of "harder". I am not familiar with that expression as it relates to code. If it is "harder" for you to program, you might start with a few tutorials.

 

Instead of telling us how you want to do something, tell us instead what you want to do. I am sure there are much better ways to achieve your goals.

 

What does the program do? What happens in the central sequence frame? What happens in the while loop? What is the purpose of the FOR loop?

 

My guess is that you are way overthinking things and there are much simpler solutions to your problem.

0 Kudos
Message 6 of 16
(3,251 Views)

I'll try to explain what i'm trying to do.
I'm sorry, i didnt do it earlier, i'm not so good at english : /.

The while loop is a Tension signal send to a LFG.
In the meantime, i have to ask a balance for the weigh (read it and write it down in a file).

I'll do it for different amplitude (for loop).

Because there is a risk with tension, i'd like it to only work the acquisition is running (2 frames of the sequence).

I hope that you could understand it.
best regards

0 Kudos
Message 7 of 16
(3,236 Views)

Post the VI you are having trouble with. From what I can understand from your posts, I would suggest a Queued Message Handler design pattern. You can find templates for this easily. 

Message 8 of 16
(3,203 Views)

Well, some sort of Producer Consumer variant, anyway.  You can find them in the examples included with labview.  As was already mentioned, there are some ready-made template you can easily adapt to your needs.  Try it and if you need help, post what you've got and we can help you make it work!

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 9 of 16
(3,164 Views)

Also have a look at this nice doc, it also explains you when and (usually) when not to use the flat sequence structure in LabVIEW...also learning from the tutorials is recommended:

http://www.ni.com/newsletter/51735/en/

0 Kudos
Message 10 of 16
(3,121 Views)