LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Passing data between several independent VIs

I have several VIs that runs independently. They don't need to pass data between them but when one of them is closing the others also must close. One Vi is always started first

Is there a good way of doing this?

I am thinking of using a Functional Global but i am not sure that this is the best way. I have attached a simplified example using FG to pass info about Running. The first Vi is always started first but the others may start in different orders.

A User event may not be useful for this.

I think that there must be a smarter way of doing this

 

 

Download All
0 Kudos
Message 1 of 4
(416 Views)

Since you need to poll the info anyway, why not to use a standard global variable?

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 2 of 4
(410 Views)

In general nothing principal wrong with this, and you can use classic global as suggested above. The only one possible race condition in theory could occur in case if one VI will be started exactly at the time point when other one finished, then one will write true at start, the other one — false at finish, and the third VI which is already running may stop or not depend on which write action will occur first. This can be solved with rendezvous which you can add between first write and while loop, then you will start all VIs "synchronously" and they will wait each other, but it depends from your high-level design and overall timing diagram — how they started and stopped. 

0 Kudos
Message 3 of 4
(392 Views)

FG or Global should work fine, don't overcomplicate things. Remember KISS.

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 4 of 4
(382 Views)