LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

While loop runs once more once stopped?

Highlight execution essentially slows down the code and basically serializes things so you can see what is happening.  Timing between things that would otherwise happen in parallel might change.

 

For your earlier image, I don't know what you did to get it behind the flat sequence.  It may even be behind the while loop.  Just delete it.   Place a new stop button down and drag it into the flat sequence frame.

 

(you might be able to use your cursor keys to move the highlighted part up until you see it and it is no longer behind structures.  Then drag and drop it in the frame.)

(OR if you do block diagram cleanup, it should  bring it out so you can see it.)

0 Kudos
Message 11 of 19
(1,990 Views)

Here is a picture of the whole loop.  I cannot delete the stop button.

0 Kudos
Message 12 of 19
(1,986 Views)

@jmaslek wrote:

Thanks, that makes sesne.

 

Total beginner question: I am adding the flat sequence, but when I do, the stop hides behind it on the block diagram.  Is there a way to change that?


I have a solution - don't do that!  😄

 

Actually, it's a little more than a joke because the flat sequence shouldn't be used unless there is no other way to enforce dataflow in the way you want it to happen.

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 13 of 19
(1,971 Views)

Hi jmaslek,

 

which button can't you delete?

 

Are you talking about the boolean control visible in the lower right corner of your image? How is this control related to your loop?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 14 of 19
(1,968 Views)

I was referring to the loop stop, not the boolean below.  It is the stop for the while, so I cannot add it. 

 

I am just extremely confused as to how I can drive data flow through the loop so that the STOP executes last (in the inner loop)

0 Kudos
Message 15 of 19
(1,965 Views)

You have to put the stop that stops your outer while loop inside the inner while loop.

 

That stop control gets read at the very beginning of your outer while loop iteration where it is probably still false.  Your inner while loop runs until its conditions stop it.  Your outer while loop will finish its iteration.  Even if you have since pressed the master stop button, it has already been read and will not be read again until the outer while loop begins its 2nd iteration.  Then the stop terminal will be read as True.  But the inner while loop is going to start all over again.  Only when that stops a second time, will the outer while loop stop.

 

 

0 Kudos
Message 16 of 19
(1,963 Views)

Hi jmaslek,

 

so you talk about the "stop terminal" of the loop? It's an important part of each WHILE loop: no, you cannot delete it!

Have you ever programmed before? Even in text-based programming languages WHILE loops always have a stop condition!

The loop will stop when "Input" is equal to "SAV\n". Maybe there is an additional condition inside the FALSE frame of the case structure, but as you only attach images instead of VIs or snippets we cannot tell…

 

In your last image you don't need the flat sequence structure inside the loop: right-click the sequence frame and remove the sequence…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 17 of 19
(1,960 Views)

If you want to stop at any time, even if SAV is not receive, place the stop terminal in the inner loop and OR the condition for the inner loop termination, e.g. as follows.

 

 

 

If you want to stop after the inner loop completes normally, omit the "OR".

 

There are many ways to do that of course. It is not entirely clear to me why you even have the outer loop. 

 

 

 

0 Kudos
Message 18 of 19
(1,933 Views)

The stop control (the thing represented on the Front Panel by a Button, and on the Block Diagram by an icon labelled "stop") goes inside the sequence, with its value tunnelled out to the Stop Indicator of the While Loop (and the Error Line running through it to sequence it).

 

BS

0 Kudos
Message 19 of 19
(1,923 Views)