LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Bringing value from 1 VI to another VI in the same Project file

Solved!
Go to solution

Hi,

 

I would like to bring a few value from the main VI to another VI under the same project file but I am not sure what is the best method of doing it. Is it by using global variable or by subvi? 

Thanks

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

There are many ways to pass data around.  Which method to use is based on what you are trying to pass around, to who (most as in how many processes), who can update the data, etc, etc.  In general, I find Queues and User Events best for passing data around.  Again, it would help if you gave a lot more information about exactly what you are trying to do.


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
0 Kudos
Message 2 of 9
(3,710 Views)

Hi,

 

The value passed can only be changed at the main VI. I am just passing a few dbl values that's all. It will be best if i can use the values passed in some arthemical function 

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

I would say that most of the variables I pass between sub-VIs are passed by wires going into 2-3 Connectors (I'm not counting the Error Wire, which is almost always coming in on the lower left) and out through 2-3 Indicators (again, not counting the Error Wire).  Very quick, very simple, very "DataFlow".

 

Bob Schor

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

Sorry but it is possible to have an example of passing of variable using subvi ?

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

@Bob_Schor wrote:

I would say that most of the variables I pass between sub-VIs are passed by wires going into 2-3 Connectors (I'm not counting the Error Wire, which is almost always coming in on the lower left) and out through 2-3 Indicators (again, not counting the Error Wire).  Very quick, very simple, very "DataFlow".


Bob brings up another good point.  Are you trying to pass data to a process that needs to run in parallel with the producer?  If not, then just call the VI directly and use the connector pane.

 

If you are running in parallel, then my next questions are:

How often are the values updated?

Do you need to process every value or just the latest value?


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
0 Kudos
Message 6 of 9
(3,683 Views)

Yes, it will have to be run in parallel. The value updates every 1 mins

0 Kudos
Message 7 of 9
(3,681 Views)

Sorry, I would like to edit the question. 

Is it possible to pass values back and forth between 2 VI? 

Both VIs will be running concurrently.

 

Thanks

0 Kudos
Message 8 of 9
(3,642 Views)
Solution
Accepted by topic author S.Neo

Hi Neo,

 

yes, that's possible!

Spoiler
global variables, notifier, queues, FGV aka AEs, …

When you keep asking such basic questions you should take the free online resources offered to help you learn LabVIEW and DATAFLOW!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 9 of 9
(3,615 Views)