Need to place sub VI in VI a number of times 
Author Message
 Need to place sub VI in VI a number of times

I need to place a subVI in my VI a number of times and each time i
need to double click it, enter some values and close it. The only way
i could think of doing this was to make it so that when you change the
values the subVI is saved under a different name.
Quick Q; What does re-entrant mean?
Is that of any use in this case?


Tue, 08 Mar 2005 17:27:07 GMT  
 Need to place sub VI in VI a number of times
Hi,
  I think you may be a little off in your understanding of how these
multiple calls to the sub.vi are going to work.

Let's answer the last question first - re-entrancy is used when you
want each call to a sub.vi to run in it's own area of memory. This is
useful if you're going to have multiple copies of the sub.vi RUNNING
in memory AT THE SAME TIME.

The mutliple calls you're making to the sub.vi, I assume, are not
going to be simultaneous, but rather one after the other. Every time
that, during edit, you've gone into the sub.vi and made a change and
saved it, you're overwriting the original settings (assuming you're
also using make current value default ).
You could create multiple copies of the same .vi, each with its own
values, but why should you need to. For example, if you wanted to add
two numbers together, you wouldn't create a new .vi to do this for
every set of numbers!
A sub.vi can be treated as a function call. Have a look at the help
files for creating sub.vi's and how to pass data, and wire up the
connector pane of the sub.vi. This will allow you to do the "editing"
of the values for run time from the top level (calling) .vi, and make
the most of the code by re-useing it. Just because a sub.vi has inputs
and outputs, it doesn't mean that they have to necessarily be wired to
controls and indicators. You can use constants to "fix" the values
you're passing in.

Hope that makes sense and helps

S.



Tue, 08 Mar 2005 18:27:21 GMT  
 Need to place sub VI in VI a number of times
Thanks for the quick reply.
The problem is the subVIs do need to run at exactly the same time each
having an output which is connected to a waveform chart.
That's why the only way i could think of solving my problem is to open
the subVI, change the values and then have it programatically save
itself to a different name.
Also is it possible to change the properties of the waveform (caption
etc.) from inside the subVI, NOT the VI in which it is contained.

Thanks!
ROb



Tue, 08 Mar 2005 18:51:56 GMT  
 Need to place sub VI in VI a number of times

Quote:
> The problem is the subVIs do need to run at exactly the same time each
> having an output which is connected to a waveform chart.
> That's why the only way i could think of solving my problem is to open
> the subVI, change the values and then have it programatically save
> itself to a different name.
> Also is it possible to change the properties of the waveform (caption
> etc.) from inside the subVI, NOT the VI in which it is contained.

If the VIs need to run at the same time, make the subVI reentrant.  That
way the calls run independent of each other, as if they were unique
subVIs with different names, but they have exactly the same code
specification.  Fixing bugs is much easier when you don't have to make
the same change over and over in all of the copied subVIs.

As for the inputs and outputs, it sounds like you want your subVI to
return a waveform that you wire to a graph on your top panel.  If you
want to set additional properties on the graph, you can either compute
the values in the subVI and return it, like the data, and have the top
level VI set all of this at once, or you can pass a control reference to
the graph into the subVI and let the subVI make changes during its call.

To get a control reference, popup on your graph, choose
Create>>Reference, an on your diagram will be a reference terminal that
you can drag onto your subVI panel, connect to the subVI connector pane,
and then wire to on the top level diagram.  On the subVI diagram,
connect this green wire to property nodes or invoke nodes.

Greg McKaskle



Tue, 08 Mar 2005 22:07:45 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Need to display sub-vi front panels without stopping WHILE loop containing those VI's

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

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

4. How do I use server to control for sub-vi from a main vi

5. Sub VI to main VI

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

7. Continuous data transfer from vi to sub-vi

8. "sub vi calling main vi"

9. Sub.vi shrinking Main.vi

10. moving average vi as sub vi

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

12. Selecting diferent sub Vi's from main VI

 

 
Powered by phpBB® Forum Software