LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can we make the loop go on for few times

bufferlab_0-1683655662085.png

As you can see in the above image that orange wired connection is connected in a loop to 1st modulation. Is there a possibility that we can make that loop to go for multiple times. 

 

 

0 Kudos
Message 1 of 8
(1,062 Views)

Hi lab,

 


@bufferlab wrote:

As you can see in the above image that orange wired connection is connected in a loop to 1st modulation. Is there a possibility that we can make that loop to go for multiple times. 


At first the answer to your question: the only loop visible in your image will run as long as you don't set the "EXIT" button to TRUE.

So yes, you can make it "loop for multiple times"…

 

Now the comment on that image: kill the VI and start over from scratch! Really!!!

Stacking several sequence structures inside of each other, with several loops and case structures mixed in between calls for nightmares!

How old is this VI and which (old) LabVIEW version do you use?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 8
(1,060 Views)

Thank you for your reply. It's the oldest version. If we have to switch to the latest, we need to upgrade all the instruments which run on it. 

0 Kudos
Message 3 of 8
(1,028 Views)

I want to repeat the process at either of the arrow, say for n times, as shown in the image. As you can see that there is "Total_N" outside the loop which I want there, but for every "Total_Nth", I want the inside part to repeat "n" times. I hope I explained it correctly.

0 Kudos
Message 4 of 8
(1,025 Views)

I think that there is something you think is a loop structure that is not actually a loop.

 

From inner to outer you have:

1. Stacked sequence

2. While loop (the ONLY loop)

3. Case structure

4. Stacked sequence

5. Stacked sequence

6. Case structure

7. Stacked sequence

8. Case structure

 

As much as I hate saying this, if there's something you want to repeat aside from the current While loop, you need to add a loop into that which will be even one more nested structure.

 

However I would also say that your application is not very maintainable it its current form.  It badly needs updating, both in LabVIEW versions and in the structure of the program.

0 Kudos
Message 5 of 8
(1,016 Views)

Kyle:

 

I think you meant outer to inner.

 

-AK2DM

~~~~~~~~~~~~~~~~~~~~~~~~~~
"It’s the questions that drive us.”
~~~~~~~~~~~~~~~~~~~~~~~~~~
Message 6 of 8
(1,009 Views)

@AnalogKid2DigitalMan wrote:

Kyle:

 

I think you meant outer to inner.

 

-AK2DM


Yes I did.  Oops.

0 Kudos
Message 7 of 8
(1,006 Views)

That's an Aztec code pyramid!

 

Simple answer, if you put a loop around your innermost sequence structure it'll to it all several times. I guess you're not interested in doing all those steps again, in which case the answer is no. 

 

What you really need to do is change it to a state machine, then you can jump between cases in any order and don't need to stack the code so deep.

 

Application Design Patterns: State Machines - NI

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 8 of 8
(946 Views)