11-23-2009 02:57 AM
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)
11-23-2009 03:02 AM - edited 11-23-2009 03:03 AM
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?
11-23-2009 03:07 AM
11-23-2009 03:22 AM
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.
11-23-2009 03:24 AM
11-23-2009 03:40 AM
11-23-2009 03:48 AM
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