LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Call SubVIs and continuously collect data from it

Hello everyone!

 

I am quite new to LabView and have the following question:

 

I have several Devices from which I want to acquire data. For every Device I created an individual VI to control the device and acquire the data. Therefore every individual VI has a While-Loop. Now I want to write a MainVI from which I launch the individual VIs in a way that the Front Panel pops up and the individual VI runs as if there was no MainVI. But at the same time I want the MainVI to collect the measured data from the individual VIs. Since I am new to LabView I don't know where to start searching. So maybe you can give me a hint what topic to search for or which examples to look at.

 

Thanks in advance 🙂

0 Kudos
Message 1 of 5
(2,710 Views)

Send data from the individual loops using queues. I just posted an example in another thread on how to do this. Open the project and look at the Get Packets.vi

=====================
LabVIEW 2012


0 Kudos
Message 2 of 5
(2,697 Views)

If you are looking for examples in the Example Finder, one of the first places I look too, for help with this project, then I suggest you look up producer/consumer architecture.  One version of this communicates between loops using queue based structure.  If you consider that you can place each loop in a separate VI and by using the same queue name for the Obtain Queue.vi you will get a "channel" between the two just like in the single VI example.   Just remember you only have to destroy the queue in one place.

 

Happy Programming,

 

Jason

Wire Warrior

Behold the power of LabVIEW as my army of Roomba minions streaks across the floor!
0 Kudos
Message 3 of 5
(2,692 Views)

Thanks for the advices! It's working and I have learned another labview feature Smiley Surprised

0 Kudos
Message 4 of 5
(2,671 Views)

@Wire Warrior wrote:

 

If you consider that you can place each loop in a separate VI and by using the same queue name for the Obtain Queue.vi you will get a "channel" between the two just like in the single VI example.   Just remember you only have to destroy the queue in one place.

 

Happy Programming,

 

Jason


Just to clarify you never need to destroy a queue yourself. You obtain and release references to it. You need to release for each obtain. Queues are destroyed automatically after the last obtained reference is released.

 

In the case of an unnamed queue there is only one obtain and therefore only one release. It is immediately destroyed automatically after releasing the reference.

 

For a named queue used in several loops or VIs you have to obtain a reference in each place since you are not wiring an already existing reference. You have to release the obtained reference in each loop or VI or else you will get a reference leak.

 

That is the default anyway. You can wire a true to Force Destroy of release queue and cause all other loops using that named queue to crash and burn. To borrow a quote from (I think) Darren: "That's like stopping your car with a tree. It works, but there may be consequeces"

=====================
LabVIEW 2012


0 Kudos
Message 5 of 5
(2,669 Views)