From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

subvi input and output

hello everyone,

I want to connect two blocks from different subvis how can i do it?

 

thank you in advance 

0 Kudos
Message 1 of 14
(1,219 Views)

Hi new,

 

use wires...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 14
(1,216 Views)

hahahah.. i know that but i have value which is  in subvi 1st that i want to give as input for a block in subvi 2. how can i do it?

 

thank you

0 Kudos
Message 3 of 14
(1,209 Views)

Can you attach your code in order to allow us a better comprehension of your needs?

0 Kudos
Message 4 of 14
(1,189 Views)

Hi new,

 

use the connector pane!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 5 of 14
(1,185 Views)

What are "two blocks from different subVIs"? (Wording does not make any sense! Some beginners call subVIs "blocks", but you obviously talk about two different things. Completely unclear!)

 

Can you attach some example code? Make sure you include (1) the toplevel VI, (2) the two subVIs, and (3) whatever you call "blocks".

Message 6 of 14
(1,164 Views)

In LabVIEW, there are (to a first approximation -- exceptions are everywhere!) two types of VIs that differ in what "Inputs" and "Outputs" mean.

  • Top-level VI (a.k.a. User Interface
    • This is the VI that you "run", on which you place your pretty Controls that have lKnobs, Buttons, Fill-in Boxes of various types (numeric, string, paths, etc.) and Indicators (Dials, LEDs, Boxes in which numbers, strings, paths, etc. can be displayed, charts and graph, and so on).
    • A major purpose of the Top-level VI Front Panel is direct interaction with the User, who manipulates the Controls and observes the responses of the Indicators.
    • All the Controls and Indicators, no matter their Front Panel appearance, appear as an Icon on the Block Diagram that is related to the type of data going in or out.
    • If you attach "wires" to Controls on the Block Diagram, they come out the right side.  Their color reflects the type of data (Integers are Blue, Floats are Orange, Booleans are Green, Strings are Pink) and dimension (scalars are thin lines, 1-D Arrays are thick lines, 2-D Arrays are two lines, other wires may be patterned-and-or-colored).
    • You "program" LabVIEW by organizing Controls and Indicators on the Block Diagram, along with Structures and Functions you may need, connecting things with wires, trying to connect end-points of similar "types" (it doesn't make much sense to connect an Integer to a File-path Indicator).
    • Depending on the complexity of your Task, you might have > 20 Controls and Indicators on a Top-Level VI.  [You could have more, but then it can become complicated and hard-to-read, sort of like the Cockpit of a Boeing 747].
  • VIs that are called by other VIs (a.k.a. Sub-VIs)
    • The main difference between a sub-VI and a Top-Level VI is the User generally cannot see its Front Panel.  This means that if you have a very pretty Knob that shows numbers from 0 to 10 on its face, it will appear on your Block Diagram as either an I32 (32-bit Integer, dark Blue) or a Dbl (64-bit Float, Orange).  The "appearance" is ignored, and you can save yourself some time by just using a "plain" Numeric Indicator on the Front Panel.
    • So if the User cannot see the Front Panel, how do you get data in or out of a sub-VI?
    • Look in the upper-right corner of the Front Panel diagram.  There are two square boxes., the left one being the "Connector Pane", the right one the VI "Icon".  The connector pane, by default, is divided into a 4-2-2-4 pattern of smaller squares and rectangles (4 small squares on the left, two sets of two rectangles in the middle, and 4 more small squares on the right).  These represent sites on your VI where you can connect those mysterious "wires" and thereby bring data into or out of your sub-VI.
    • Does this sound familiar?  I certainly hope so.  Someone should have told/shown you how to connect a Front Panel Control to one of the six "left-hand" connectors, and Front Panel Indicators to one of the six "right-hand" connectors.
    • "What?  Only 6 inputs and 6 outputs?"  You should strive for no more than 2 Inputs and 2 Outputs, not counting Error In (always in the lower left corner) and Error Out (always on the lower right corner).  This is Good LabVIEW Style, which is not bad to learn at the beginning.
    • When you place your completed (and saved) sub-VI on another VI's (say, the Top-Level's) Block Diagram and move your Wiring Tool close to it, it will "come alive" when it gets close to an unwired Connector.  Click on the Connector and you can "pull out" a Wire that you can wire (as appropriate) to a Control, Indicator, or another VI's Input-or-output.

Bob Schor

Message 7 of 14
(1,154 Views)

thank you for explaining. i have 8 inputs and 5 outputs for every subvi. is it possible to connect? 

0 Kudos
Message 8 of 14
(1,089 Views)

Hi new,

 

yes.

Think about using clusters…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 9 of 14
(1,077 Views)

@newmemeber123 wrote:

thank you for explaining. i have 8 inputs and 5 outputs for every subvi. is it possible to connect? 


Yes, but it sounds like a good idea to bundle some or all of them into a cluster and use that. Just like Error in and out are 3 element clusters, you can create clusters and use those wires as inputs and outputs. Make the clusters a Type Def (with a logical name and icon) and use that and any changes you need to do will propagate to all automatically.

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 10 of 14
(1,075 Views)