How Can I Stop multiple while loops using subVI 
Author Message
 How Can I Stop multiple while loops using subVI

Thank you very much, it is working now. i am new to this labview and
just last month only i started to learn Labview. Once again thank you
for answer EH.


Mon, 15 Aug 2005 21:33:21 GMT  
 How Can I Stop multiple while loops using subVI
eh's answer (using control references) is good.  As he says, there are
a lot of ways to do this.  There has also been a lot of discussion on
this.  If you enter "stop mulitple while loops subvi" in the ask box,
you'll get thousands of answers.
You need to understand a couple of things about reading controls and
passing data to subVIs.
1. A front panel control gets read only once, unless the control is in
a loop, or you use local variables or property nodes or control
references.  So in your calling VI, the Stop button was read only
once: when the program first starts and passes its value to the subVI.
You can operate the control multiple times while the program is
running, but nothing on the diagram sees the new value.  eh creates a
reference to the control so you can read the control multiple times in
the subVI.
2. A VI passes parameters to a subVI only once per call.  Changing the
source of the parameter (the control) in the main VI doesn't send an
update to a running subVI.  When the subVI starts, it reads the passed
parameters (controls wired in the calling VI), and then it basically
disconnects its inputs from the calling VI.  Even if you read the
controls in a loop in the subVI, the subVI never gets any updates from
the calling VI through its front panel controls.  Two ways to get
updates are by using control references (like in eh's example) or
globals.
P.S. Your subVI had a very tight loop just waiting for the user to
press a button.  This type of loop can slow the whole system down.
Anytime you're in a tight loop waiting for operator input or for a
global, etc., to change, it's a good idea to include a delay.  I
typically use the wait mS function from the Time&Dialog palette to
generate a 100 ms delay.  While wait mS is running, it frees up your
system to do other things.  Even if you don't think you're doing other
things while your program is running, Windows is.


Mon, 15 Aug 2005 21:52:17 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. How to stop recording data using a while loop

2. nested while loops, inside loop not stopping correctly

3. Using CGI module with 'canned queries'

4. extracting data from subvi via main vi before subvi is finished

5. Dynamic start of subvi without waiting for end of subvi

6. using while loops within while loops?

7. Troubles using while loops and case loops

8. Can't stop the loop!!!

9. How to stop AO in while loop

10. Stopping a while loop after each iteration??

11. replace a subvi used in several other vi

12. Stopping 2 while loops with one boolean.

 

 
Powered by phpBB® Forum Software