07-05-2011 06:26 PM
Three programs are configured to run independently but all calling information from the same cDAQ. When two are run simultaneously, it throws a "Resource Reserved" error. I thought the best solution would be to combine the three VIs into one, then call all the data using a single DAQ Assistant and send it to each system independently. My issue now, though, is that since I'm combining independent programs, they're held by a front panel boolean and case structure (e.g. click this button to begin the test, hit stop to end test), all held within an independent while loop. Currently, the DAQ Assistant is run in a sub-VI outside of all of the case structures within a while loop -- data is then sent through each case structure and into the nested while loops. Whenever I turn one on, it only takes the first value recorded -- I suspect the DAQ needs to be moved into the nested while loop, but that would cause the same error I initially had. Wiring the error outs to the error ins throughout the program has no effect; this results in only one of the cases working correctly.
How can I use one DAQ Assistant to send data to all three independently?
07-05-2011 06:33 PM
If the DAQ assistant is outside the while loop, then it only runs once.
The best alternative is to create a separate while loop that does nothing but do the acquisition. Then break up the data and use 3 queues or notifiers to send the data to each of the places you need to use it.
07-05-2011 06:37 PM
I was reading about queues the other day and thought that I was onto something. Each of these areas are sectioned off by a case structure, then a nested while loop within that case structure. If I place a while loop outside of the case structure, will the queue still fill up with data?
07-05-2011 06:49 PM
Also, what's the advantage of queues over local variables?
07-05-2011 07:19 PM
Queues make sure all of the data gets passed and processed.
Local variables might cause some data to be missed, and some data may be repeated. It all depends on the relative execution rates of the write to the local variable and the read from the local variable.
07-06-2011 11:51 AM
I placed the Data Acquisition SubVI in a while loop outside of the rest of the program, but once I hit Enable A (B, or C), it reads 0 on the outputs until I stop it, at which point it reads one number. This was using local variables, I'll try using queues and get back to you.