LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

running one sub vi in background while the main vi uses it's generated data, producer/consumer?

Hi,
 
I would like to have a subrutine running at the same time as the rest of the main vi. The subrutine will be constantly producing data, and the main rutine should do different tasks depending on which data has generated the subrutine in that instant. I have read about producer/consumer design http://zone.ni.com/devzone/cda/tut/p/id/3023 but I don't know how to implement this with LV 5.1   Somebody know if it's possible, or there is something missing in my old LV version? The name of the sub vi about queues mentioned in the link are different than the one I have, and I don't achieve to connect correctly the ones I have... (that are create queue, destroy queue, insert element queue and remove element queue).
 
Or, does anybody know other way to do what i want?
 
Please, some help..
 
Thanks a lot.
0 Kudos
Message 1 of 2
(2,413 Views)

Hi javivi,

      The queues in 5.1 are capable of supporting the producer-consumer model.  See the queue example under "Execution Control Examples".  It's showing a simple string value being "inserted" and "removed". To insert non-string data-types, use "Flatten to String" before "Insert Queue Element" then "Unflatten from String" after "Remove Queue Element".

What "different tasks" will you do based on the data?  How is the data being read by the program - are you reading an analog-input?  Is it a "continuous" acquisition? 

Cheers!

"Inside every large program is a small program struggling to get out." (attributed to Tony Hoare)
0 Kudos
Message 2 of 2
(2,392 Views)