LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to stop 2 while-loop

Hallo
 
If I have 2 while -Loop, the 1st while-Loop is in the 2nd while and in each one there is a case- structure.
I want that the 1st while depends on the 2nd that means if i stop the 2nd the  1st must also stop. so i used the property node but it didn't work ? any idea? (see plz attachment)
thanks
Toni
0 Kudos
Message 1 of 8
(4,102 Views)
Toni,

stacking loops is always a bad idea esp. if they are while loops. The problems you are facing in your VI are the following:
a) You selected the wrong property, it should be value
b) Your inner loop breaks the outer loop in execution. So pressing the stopbutton will always finish the whole VI. Intended? If so, why stack loops??
c) Writing code which has to use property nodes or variables to pass data is not the best idea. This is sometimes neccessary, sure, but in your example, i am sure there is a better way without those elements...

hope this helps,
Norbert
Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 2 of 8
(4,098 Views)
Hi Toni,

if the loops are stacked then you can simply wire the stop condition of the inner loop to the outer loop stop condition... (Remember: in LV the wire holds the value, so prefer wires instead of locals/property nodes!)

But as said before: there are surely better designs possible.
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 3 of 8
(4,092 Views)

Hi Norbet,

first thank you for your reply.

the aim of this LV is to move Axes and this will be done in the 2sd while-loop (I have to move the axes seversal times) and  the 1st while is for the emergency case to stop all the axes. and the problem is if i don't press the emergency buttom the Lv don't stop.

Toni

0 Kudos
Message 4 of 8
(4,091 Views)

Hi dctoni,

it would be better if you can show more of your code, so we can get the understanding for what you really need.

Mike



Message Edited by MikeS81 on 04-23-2008 11:20 AM
0 Kudos
Message 5 of 8
(4,082 Views)
Toni,

i don't want to step on your toes, but esp. motion applications often have the requirements of a "sudden death" button to kill all movement of the motiondevices. But it is very common, that this must not be done in software!
If you really may solve that in software, you definetly have to switch to another plattform like RT. Windows cannot guarantee any cycletimes within your software, so you propably have several seconds until the application stops. This is way too much! Sure you can tweak Windows for better performance, but this is still critical.
The main issue here is, that you should switch to a better architecture with some kind of watchdog, looking only for the button. Sadly, if you have never worked on advanced architecturs, this is very hard to explain....

Norbert
Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 6 of 8
(4,079 Views)
Hi Toni,

the attachment shows how to solve your question.

But: it will not solve all problems mentioned in your task description. Other designs may handle this kind of algorithm much better...
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 7 of 8
(4,045 Views)

Thanks GredW

you r right, i have to find another way

0 Kudos
Message 8 of 8
(4,040 Views)