LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to stop a "continue if true loop" inside a "stop if true loop"?

Hello guys, I have "continue if true loop" that I want to stop when I press the stop button of the surrounding "stop if true loop".

 

Notice that I ran through all of this to keep the push button released and keep the LED lit.

 

However, when I press the stop button nothing happens, so:

 

1) How can I overcome that?

2) Are the shift registers even necessary?

 

(Please fix my VI)

T. A.
0 Kudos
Message 1 of 7
(3,261 Views)

Hi Al-J,

 

you can overcome your problem by moving the "light" control into the inner loop...

 

1) Have you ever tried the cleanup-tool?

2) Have you ever tried debugging using the highlight-tool?

 

Edited:

3) Ever used a wait statement inside loops?

Message Edited by GerdW on 11-23-2009 10:03 AM
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 7
(3,257 Views)
Not 100% sure what u're trying to do? are you wanting the inside loop to run while the light is on but exit if the stop button is pressed... like attached?
Message 3 of 7
(3,250 Views)

Your code makes no sense. Why don't you study it with execution highlighting while operating the controls.

 

What is the purpose of the shift registers? none! Delete them. Why did you place them?

 

If you want LabVIEW to react to a button, the control terminal should be in the innermost loop. Currently, the code cannot escape from the innermost loop, because the value of the termination condition cannot change. It will spin millions of times per second doing nothing useful.

 

There are many ways to keep an LED lit after a latch action switch, e.g. with an event structure. (see attached. Make sure to stop the VI with the stop button, else the LED remains lit.). Of course the code is pretty dumb, because you can never turn the LED off again while the VI is running.

Message 4 of 7
(3,244 Views)
ok the attached VI did it 😄 thank you both, kudos for all
T. A.
0 Kudos
Message 5 of 7
(3,243 Views)
hey altenbach, one question, how did u "program the structure to do that?
T. A.
0 Kudos
Message 6 of 7
(3,228 Views)

The structure altenbach is using is the event structure. This structure is not part of the base developement environment of LV. So if you have LV base, you can use VIs containing the structure, but you cannot create them.

So please check which package of LV you have.

You can solve your request without using the event structure at all (so a polling mechanism), so you do not really need a "bigger" package, but it helps (since event based programming is often better in performance).

 

But one hint:

Never stack while loops except you have a good way to terminate both.

 

hope this helps,

Norbert 

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
Message 7 of 7
(3,224 Views)