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.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Background VI question


I need to have a VI running on the background constantly monitoring a value measured by DAQ. I want to put the value on top of the screen, and some other VI need to pull the value from this background VI from time to time. I guess I can use a background VI and a global constant to transfer data between this VI and others, but I(or other users) will have to remember to open and run at least two VIs and have two windows on the screen. Is it possible to put everything in one VI?
0 Kudos
Message 1 of 7
(2,816 Views)
The simple answer to your question is yes.  In order to give a more specific answer the question needs to be more well defined.
 
It sounds like you have not read the portion of the manual with regard to creating and using subvis.  Any vi that you have written can be used as a subvi in another program.  You just need to set it up for wiring.  There are also a number of ways to pass data between running vis (queues, notifiers, LV2 globals, etc.).  Each has its merits and weaknesses and should be decided based upon your specific needs.  I suggest that you read these sections of the manual and then if things aren't clear you'll be able to more clearly articulate your question.
 
Message 2 of 7
(2,808 Views)
The problem of using subVI is that I have to wait until the subVI finishes before I can do something else, that's why I was thinking of using a seperate VI that runs on the background, constantly measuring the DAQ signal and doesn't intefere other VIs.
0 Kudos
Message 3 of 7
(2,802 Views)
Run the subvi in a separate loop of your main vi.  LabVIEW will parallel process anything that does not have data dependency.  See http://zone.ni.com/devzone/conceptd.nsf/webmain/C54BADADD8BBDE4286256C5200533B80 for an example of one way that this can be accomplished.
Message 4 of 7
(2,795 Views)
Thanks, that looks like what I need.
A question for the queue, the consumer in my program doesn't need first in-first out type of data from the producer, but rather the latest data produced, so I can't use Queue.  Is it better to use local variable, global variable or something else? (for speed and memory consumption stand points)
0 Kudos
Message 5 of 7
(2,782 Views)
Just set the queue to contain only one element.
Message 6 of 7
(2,776 Views)
Brilliant!
0 Kudos
Message 7 of 7
(2,771 Views)