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: 

Passing Boolean values to sub VIs (Refnums)

Solved!
Go to solution

I've recently searched for information on using Boolean Refnums to pass Boolean values, such as switches from the main VI to sub VIs.  The problem I'm having is that a terminal does not appear on the sub VI in the main VI to connect the reference to the input of the sub VI.      

 

The example I downloaded from NI has a terminal on the sub VI in the main VI.  Why is my sub VI missing this terminal? I've attached the example I downloaded from NI to help me understand passing Boolean addresses to sub VIs.  They are labeled Main.VI and SubVI.VI below.  What else needs to be done to add the terminal to the sub VI so I can connect it to the reference in the main VI?

 

I've attached my code thus far as well.  init.VI is the main VI.  Generic_BK1900B_Logic_Function(SubVI).VI is the function that I'm having an issue with.  The final VI is a general commands sub VI that can be used for voltage and current commands.

 

 

 

0 Kudos
Message 1 of 9
(3,196 Views)

When attaching multiple files, please put them in a single zip file, especially if you use common names like main.vi or init.vi. My downloads folder already has several old VIs with these same names, leading to crosslinking if I try to open your toplevel.

 

Thanks.

0 Kudos
Message 2 of 9
(3,182 Views)

Maybe start learning about building and assigning the connector pane?

 

Still, it is not clear why you even use references instead of the boolean directly. Any reason?

 

(And please, it is extremely annoying if every single VI opens maximised to the screen. We cannot efficiently inspect something if we only can see one VI at a time. Thanks!)

Message 3 of 9
(3,177 Views)

I apologize for making it somewhat annoying for you.  I am fairly new to using the community resources section.  I'll try and figure out the issue.  Thanks.

0 Kudos
Message 4 of 9
(3,172 Views)

BTW, I've tried to use a Boolean Control in the sub VI on the input of the application, but it does not show up on the VI in he main function.  That's when I did some digging and found that I may need to generate a reference and copy it to the front panel of the sub VI.  This was all based on past instructions of similar issues.

 

Shane

 

0 Kudos
Message 5 of 9
(3,168 Views)

All you need is a boolean connector in and a boolean connector out (in the case of the simple example, see picture) and similar modification for your bigger things.

 

Typically all connection should be just by native value. Using references is only needed in certain very limited scenarios (e.g if you want to change the properties of a front panel object from within a subVI or if the subVI runs independently and you want to update something before the subVI returns.)

 

All you code gets called and returns right away.

 

subCon.png

0 Kudos
Message 6 of 9
(3,127 Views)

Thanks for the tip.  I did click on the link you provided in your initial email and was able to generate a terminal; thank you, that was quite helpful. 

 

Quick question, does the error out normally pass a true or false when there is no error?  It seems the error is passing a true out of the VISA serial configure VI (arg 8).  What I don't get is that flow control is disabled, which is what the manual calls out for the Power Supply I'm using.

 

Shane

0 Kudos
Message 7 of 9
(3,057 Views)
Solution
Accepted by topic author Shane71

@Shane71 wrote:

Quick question, does the error out normally pass a true or false when there is no error?  It seems the error is passing a true out of the VISA serial configure VI (arg 8).  What I don't get is that flow control is disabled, which is what the manual calls out for the Power Supply I'm using.


If there is an error, the Status of the error cluster will be TRUE.  If you are getting an error from the VISA Configure Serial Port, then you are probably using an invalid reference or a port that is already being used by something else (Putty, a previous run of your VI and you failed to close the port, etc).


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 8 of 9
(3,047 Views)

AH HA!  EUREKA!  Thanks for your help.  I'll add that code in!

 

Shane

0 Kudos
Message 9 of 9
(3,013 Views)