LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is that any way to tell if the terminal is connected or not?

Hi all,

  I am designing a subvi to accept 4 inputs. 3 of them are DBL and the last one is boolean. the boolean input could be connected or not. If it does not feed with external value, then it will use those 3 DBL values to do the calculation but if it is feed by either true or false, a special value will be used for calculation. Now the question is how can I tell if that terminal is connected or not?

0 Kudos
Message 1 of 3
(2,801 Views)

You can't.

As an alternative you can replace the boolean with an Int with default value -1 (just an example).

 

If the Int terminal is not connected the value will be -1 (and you can use the three DBL to do the calculation)

If the Int terminal is connected and set to 1 or 0 you can use the special values.

 

Regards,

Marco

 

 

 

 

0 Kudos
Message 2 of 3
(2,786 Views)

It's also possible in principle to use the DBLs themselves and then you don't need the fourth input - set each DBL's default value to an invalid value (like NaN) and then compare it to that value (if it's NaN then you need to use the Not a Number? primitive to compare). If it matches, then you didn't wire anything and you can use your special value.

 

If this doesn't work for you and you want to use Marco's method, then I would consider replacing the int with a typedef enum, where the default option is to use the special value, as this is clearer than the int.


___________________
Try to take over the world!
Message 3 of 3
(2,771 Views)