How do I use server to control for sub-vi from a main vi 
Author Message
 How do I use server to control for sub-vi from a main vi

I have to run 4 simultaneous sub-vi from a main vi and get the results
from those. The sub-vi will not start at the same time so I need that
the main vi still active. I think that I need to use the server-client
function, but I'm not really sure of how it works.


Sun, 12 Dec 2004 02:47:58 GMT  
 How do I use server to control for sub-vi from a main vi
Hi,

Why you think that your main.vi will not still active?It lunch
sub.vi's and stop?
Add while loop in main.vi. You will wait until you get results from
all sub.vi's.



Sun, 12 Dec 2004 15:41:55 GMT  
 How do I use server to control for sub-vi from a main vi

Quote:

> Hi,

> Why you think that your main.vi will not still active?It lunch
> sub.vi's and stop?
> Add while loop in main.vi. You will wait until you get results from
> all sub.vi's.

The VI's you need are on the VI server palette.  You need to open a
reference to the VI you want to dynamically launch.  There is a VI on
this palette to let you set the front panel values (properties)  and
then you can run it with another that lets you choose the run method.
You will need to decide whether you want your main program to wait for
the dynamically launched VI or not.  This is a boolean you set when
you use the run method.  Also you will need to decide whether to have
the dynamically launched VI dispose of it's own references or whether
you want the main VI to do that.  If the main VI does that then you
will need to Close the VI reference when you are done.

Also you will need to come up with a way to signal information back
and forth between the main VI and any dynamically launched VI's.  You
can best do this with the multithreading VI's like notifiers, queues,
semaphores, etc.  You can also use global variables but be careful of
race conditions that can occur.  Also watch out for any shared
resources like I/O cards, test instruments, etc. that can only be
accessed by one VI at a time.  If you have any of these you will need
to use semaphores to protect them or find a way to let all VI's share
the information from one I/O resource using a notifier.

If one of your dynamically launched VI's has an unexpected error you
can signal this back to the main VI using a queue as an error queue
and an occurrence to signal the main thread that an error has occurred
so that it can check the queue.

Douglas De Clue
labview developer



Fri, 17 Dec 2004 07:41:43 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Using control reference with a Sub-vi over a TCP VI Server connection

2. Using control reference with a Sub-vi over a TCP VI Server connection

3. Sub VI to main VI

4. Data transfering from sub-vi to main-vi

5. "sub vi calling main vi"

6. Sub.vi shrinking Main.vi

7. i do not want to halt main vi while executing sub vi

8. Selecting diferent sub Vi's from main VI

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

10. Using VI Server to pass data between a Labview Executable and a VI

11. how to close a sub-vi when running the main

12. SubVI's in Main VI

 

 
Powered by phpBB® Forum Software