LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple programs reading from same DAQ simultaneously

     Is it possible to have multiple programs read separate analog in channels on the same DAQ at the same time.  If so how can I do this. Each program has separate tasks and is using the DAQmx read.vi.  I can run one at a time, but as soon as I start a another I get the error 50103 occurred at DAQmx Read (Analog DBL 1Chan 1Samp).vi:1.  The specified resource is reserved.  The operation could not be completed as specified. 

     I attempted to reserve the the DAQ before reading and unreserve after using the DAQmx control task.vi but this resulted in the same error.

 

I am using labview 8.6 with the usb-9162 with the ni 9213 cartridge.

0 Kudos
Message 1 of 8
(4,977 Views)

Not that I know of.

 

I will generally put together a background process that offers the data updates as a service to other clients. Yes, that is not what you wanted to hear.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 2 of 8
(4,961 Views)

You would have to close your DAQmx reference in one vi before another vi could open one on the same DAQ device.  You could have some sort of flag variable, maybe a LV style functional global, that would signal the need for DAQ use.  Some sort of arbitration scheme in a separate vi would determine who gets priority over DAQ use.  It would then send signals (more funtional globals) to each subvi telling them who should close and who should open.  The differenct vi's would have to coninually poll the functional globals to see if they should open or close their session.  This will be quite complex.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 3 of 8
(4,955 Views)
It would be much easier to use one overall data acquisition program, then write the data from each channel to shared variables.  You can then read the shared variables in your separate programs with no conflict.
Message 4 of 8
(4,942 Views)
It seems like I am going to have to create another VI that does all of the reading from the DAQ.  Can someone explain how to pass data from one program to another.  I am assuming that it will be some sort of variable.
0 Kudos
Message 5 of 8
(4,931 Views)

You could use Shared Variables.  Will the different vi's all be subvi's from one main?  If so, you could create a queue to pass data from one vi to another.  Or you could use a LV style Functional Global.  Or you could use just regular Global variables.  Globals can be accessed by different vi's without having a main.

 

- tbob

Inventor of the WORM Global
Message 6 of 8
(4,926 Views)
Thanks for the help.  I ended up using a background program that reads all of the channels of the daq and then passes that data to a global array.  I then simply call that global array variable from the background program and pick out the data that I want for each of the seperate vi's. The only downside is that I have to run the background program seperatly in addition to the other programs that I have recording that data.
0 Kudos
Message 7 of 8
(4,883 Views)
Just a word of warning.  When using globals, beware of race conditions.  Consider using a Labview 2 Style Functional Global or an Actin Engine (search the forum for these terms to get many examples).  This helps to prevent race conditions.
- tbob

Inventor of the WORM Global
0 Kudos
Message 8 of 8
(4,860 Views)