LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to call data acquisition on same cDAQ

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? 

 

 

 

 

Block Diagram.png

 

 

 

 

Front Panel.png

0 Kudos
Message 1 of 6
(2,676 Views)

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.

0 Kudos
Message 2 of 6
(2,673 Views)

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? 

0 Kudos
Message 3 of 6
(2,671 Views)

Also, what's the advantage of queues over local variables?

0 Kudos
Message 4 of 6
(2,665 Views)

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.

0 Kudos
Message 5 of 6
(2,654 Views)

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.

0 Kudos
Message 6 of 6
(2,636 Views)