LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How To Create a SubVi and Limit Required Inputs

Hello,
Description:
I have created a VI that reads in voltage values from the NI USB-6008 device. After putting that value into a formula, I compare the new value with an array of data and output a corresponding value (this is not too important for the problem).

Problem:
The VI currently works great. My goal is to make it into a SubVi that can read in various channels and output their values. However, when I attempt to make a subVi thourgh Edit>>Create SubVi, the subVi created requires many inputs because of the many controls I utilize in the VI.

What I want to do:
Is there any way to use the default values of the controls in the SubVi and not require the user to input each control's value into the SubVi? Or, do I have to change my controls to be constants?

Any assitance would be greatly appreciated.
0 Kudos
Message 1 of 2
(2,478 Views)
You don't have to create a subvi by using the Edit - Create Subvi button. Any vi can be a subvi. Go to the front panel, right click on the icon in the top right corner, select show connector. Figure out how many inputs and outputs you want to connect to the main vi. Right click on the connector pane and select Patterns, then the pattern that fits your needs. If you want to have the main send a channel and have the subvi send an output, choose the 4 connector pane pattern. Put Error In and Error Out clusters on your front panel. Wire the channel input control to the top left terminal of the connector pane, the output indicator to the top right connector, the Error In to the bottom left, and Error Out to the bottom right. It is good to use the Error In and Out to indicate errors and to help control execution order through data flow. Save the vi. In your main block diagram, go to functions - Select a VI, and select the vi you just saved, which now becomes a subvi to the main. You can wire a control to the new subvi top left, and so on...
- tbob

Inventor of the WORM Global
Message 2 of 2
(2,469 Views)