LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to stop execution in while loop without stopping execution of other loops in the same vi

HI
 
I am quite a novice in Labview.
 
I have a problem in my project. I used a while loop inside my vi to build an array of ten values along with other loops. Then I used a stop button to stop manually the while loop. But it seems like the loop doesn't stop in the middle of the array building and so other loops in the vi doesn't work until the while loop finishes building the array and as soon as while loop execution is over, the complete vi stops. But all that I wanted was to build the array using the shift register along with the control to stop building array anytime. And not to stop execution of other structures when the while loop finishes.
 
Can anyone help me?
Rahul
 
0 Kudos
Message 1 of 20
(4,357 Views)

Hi Rahul

Basically, if you have nested loops (one loop inside another), the outer loop iterates if all inner loops are stopped.

If you want to build an array of 10 values, why don't you use a for-loop?

It is also helpful, if you could post your vi or a picture (please on *.bmp). So we could describe a solution based on your work.

Thomas

Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 2 of 20
(4,331 Views)
Hi Rahul,
 
Looks like you are not using multiple while loops in a single VI properly.
 
Just post your VI and we will tell you how to go about.
In the meantime, have a look at this VI with multiple loops, i am building an array in one of the loops
 
Regards
Dev
 
0 Kudos
Message 3 of 20
(4,329 Views)

Hi

 

Thanks a lot for your help. I am attaching my vi. It seems like I can execute and stop individual while loop asynchronously, but the problem is I cannot synchronously stop or execute both while loop using one control instead of two. The other problem is the case structure is not executing at all even though I get values in the arrays and the vi stops execution as soon as both the while loop execution finishes and so the case structure doesn't work at all.

Thanks and waiting for your reply.

Rahul

0 Kudos
Message 4 of 20
(4,323 Views)

Sorry I forgot to attach, Here is the vi

Rahul

0 Kudos
Message 5 of 20
(4,321 Views)

Your vi is not attached.

Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 6 of 20
(4,318 Views)
Could you post it as LV7.0 please?
 
File>>Save with Options>>Save for previous
Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 7 of 20
(4,316 Views)
Hi Rahul,
 
Modified ur Vi to work with single button.
 
But the subtract case is not in any loop.
So, once both the loops stop, the subtract case will execute only once. Depending on state of subtaract boolean at that time, corresponding case will be executed and the Vi will stop.
so think of a logic where u can put this also in a new loop.
Or you can also incorporate it in one of the two loops and pass the other loop's data to it.
Let us know how you will proceed in this regard
 
I am posting your VI as well a VI with my modifications VI in Labview 7.0 so that Thomas can give his suggestions too
 
Plus, always keep a time delay in your while loops.
 
Oh sorry, the "arrayinouttestnewfinal.vi" is the modified vi Smiley Wink
 
Regards
Dev
 

Message Edited by devchander on 01-10-2006 06:15 AM

Message Edited by devchander on 01-10-2006 06:19 AM

Download All
0 Kudos
Message 8 of 20
(4,311 Views)

Ok - so here is my solution (I took the modified vi from devchander as basic vi).

Here are my comments on the modified vi:
If you want to stop two separate loops with one boolean, there is no reason to keep it as two loops - that's why I took the content of the second loop (the left one in the original vi) and placed it in the other loop. So there is just one while-loop now.
Furthermore I placed the terminal inside this loop, so that it is read on each iteration. If it is outside, as in the original vi, it is just read, when the vi is started.
In addition I changed a datatype (see labels in the vi) and the mechanical action of the stop-button.¨

If there are still open questions, just ask.

Thomas

Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 9 of 20
(4,286 Views)

Hi rahulbanik,

Does this solves your problem???We don't need the second loop just as becktho said...........

see attached vi in LV8.Sorry becktho ....don't have 7.0.

Ohiofudu.

Certified LabVIEW Architect
Certified TestStand Architect
0 Kudos
Message 10 of 20
(4,298 Views)