Adding inputs and outputs to sub VI's

By Austin Steeno - 1/12/09 (Last revised 1/12/09)

-------------------------------------------------------------------------

This tutorial assumes you have basic knowledge of how to use LabView 8.5.

-------------------------------------------------------------------------

Items to note:

  • I will be going through this tutorial with auto-tools turned on.

-------------------------------------------------------------------------

In this tutorial I am going to show you how you can add extra outputs and inputs to subVI's. The process is fairly simple and can be applied in most any situation, so, I will be doing this example in a regular VI instead of the robot code since I have no need for it.

Lets get started!

First off, I just opened up whatever VI I'm working on that contains the subVI I want to modify.

Now, lets say that I wanted to add 1 more input and 2 more outputs to my subVI. To do this, go ahead and double click your subVI to open it up.

Here is what my subVI contains:

Nothing complex, just some simple multiplication.

Now since this tutorial is more about adding inputs and outputs and not how to use LabVIEW, I'm going to skip over some of the menus I got to and such, only telling you what's relevant.

To add an input I need to switch over to the front panel and create a numerical control.

Now, to create the outputs I need to add some inicators. I'll create and place 2 on the front panel.

Now I'm just going to hook up the inputs and outputs to feed and display whatever calculations I want. This part will vary greatly from person to person depending on what you're doing. Anyways, here's what I'v set up:

Ok, now switch back over to the front panel. In the top right you'll see the icon associated with your subVI.

Right click on this icon and select "Show Connector".

Now you will see something like this:

This is likely different from the subVI you are working on, but they are all basically the same. The connectors on the left are inputs, the ones on the right are outputs. You will notice the top 2 are colored in in this image, indicating that they are in use.

Now, lets add our second input. Click the square on the left below the one that is colored in.

Now, click on your input, in my case the "2nd Number" input. The input should become selected, and the connection slot should fill in with color, indicating that the two have been linked.

Now, repeat this same processs for your outputs, only this time selecting slots on the right of the icon.

Ok! Thats all for creating the connectors. Go ahead and select: File > Save All. (If its promts you with a dialogue box asking to save it under a new name, hit cancel, it will still save it. I'm not sure why it asks to save it under a new name... I hadn't had that happened to me until recently.)

Now, back in your main VI hover your mouse over your subVI (you may have to deselect it before hovering over it) and you should see the inputs and outputs you've added.

Thats pretty much it! You're done!

 

I hooked up my new inputs and outputs to test it out. Here's my results:

 

-------------------------------------------------------------------------

 

I hope you found this tutorial helpful. If you see any errors, have any suggestion or have any questions please feel free to contact me at ajsteeno@cox.net or you can PM TotalChaos on ChiefDelphi.