Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI
1 ratings:
 2 out of 5     Rate this Document

How Do I Programmatically Check if a SubVI Input Terminal is Wired?

Primary Software: LabVIEW Development Systems>>Base Package
Primary Software Version: 8.0
Primary Software Fixed Version: N/A
Secondary Software: N/A

Problem:
I have a subVI and its behavior depends on which inputs are wired to it, and I want to programmatically check if an input terminal is wired. How do I do this?

Solution:
You can programmatically check if an input terminal is wired to the subVI by comparing the current value of the input to its default value. You will have to set the default value of the input to an improbable value. The boolean (Is input value default?) can be used to control the behavior of the subVI.

For example, here is a simple subVI that adds two numbers together. If x is wired, do x+y. If x is not wired, pass y through to the output.

Here, the x control has been assigned the number 999999 as default; it is assumed that x will never hold that value.
 
 
Case 1: Add x and y if x is wired (i.e. x is not equal to 999999)



Case 2: Pass the value of y through to the output if x is unwired (i.e. x is equal to 999999)

Default values can be assigned by changing the value of the control on the front panel, and selecting the "Make Current Values Default" option under "Tools".

Related Links:

Attachments:





Report Date: 02/27/2008
Last Updated: 05/06/2008
Document ID: 4IQGTUCF

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit