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.
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.
01-08-2019 04:58 PM
Hello,
I have created an event structure to call different subVI's to do different tasks. Picture 1. When I select for example headgates, it brings up a new window with the front panel of the headgates subvi. What I want to do is push variables from my main VI to the headgates subVI. I have wired subvi's before using wires and connecting arrays, but the method I used from a tutorial online does not explain how to push variables such as arrays from the main VI to the sub. I have tried local and global variables ,but my I don't know what I am doing with them and the labview help online is all but useless in explaining in simple terms how to use each object.
Thank you.
01-09-2019 03:27 AM - edited 01-09-2019 03:28 AM
Use a VI>Control Value>Set or VI>Control Value>Set Multiple method before running the VI.
01-09-2019 05:57 AM - edited 01-09-2019 05:58 AM
Connect your required terminals on connector pane as shown below, and use it vi wherever you need just pass the values into it.
01-09-2019 06:25 AM
@SabariSaravanan.M wrote:
Connect your required terminals on connector pane as shown below, and use it vi wherever you need just pass the values into it.
That doesn't help when dynamically starting a VI, as OP tries to do.
01-09-2019 01:43 PM
@stevenette wrote:
I have tried local and global variables ,but my I don't know what I am doing with them and the labview help online is all but useless in explaining in simple terms how to use each object.
Local variables are local to each subVI, but global variables should work just fine. What did you try? Did you see the help?
In lieu of global variables, you could also do an action engine if you need more intelligence/modes.
Do you need to set these values only at the subVI call or also once the subVI is running? You could launch the subVI using "Start Asynchronous Call" and wire some inputs. For later, use the global or action engine.
Another option would be the use of queues.
Also make sure to keep the terminology clear. You are pushing values, not variables (even though the values are variable :D).
As you can see, there is a large variety of solutions, but we cannot really tell what's best unless we have more information. Of course we could provide more specific help if you would attach the actual VIs, and not just truncated, incomplete pictures. (There are quite a few questionable code constructs visible.)
01-10-2019 02:21 AM
Another solution is to use a call and forget dynamic call (Start Asynchronous Call). That would give you the VI connector pane as interface, except the VI runs dynamically. You can then wire the inputs just like a normal subVI.
01-10-2019 09:35 AM
01-10-2019 09:39 AM
01-10-2019 12:13 PM - edited 01-10-2019 12:15 PM
Ok, I have created 2 new vi's to better explain my position. When I create a main VI and a subVI, I can easily pass data through global variables back and forth. When opening up a subVI through the main VI, I no longer can pass data in real time. Please see my examples to try yourself. Thank you.
P.S. I just used the pull down menu item labeled "Headgates" so that is the only one that will explain what I am trying.
01-10-2019 12:23 PM
First you were talking about passing from Main to Sub.
Now you are talking about messages both ways.
You really should be using queues in that case.