Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Accessing USB DAQ 6363 from multiple Win32 processes.

I have referenced this link, but I'm not sure it applies to me.

http://forums.ni.com/t5/Multifunction-DAQ/Background-Server-to-allow-multiple-programs-to-read-the-s...

 

I'm using DAQmx on Win7 x64 with Visual Studio Community 2015 and C/C++.

 

I have multiple (up to 24) instances of a Windows .exe program requiring analog data from a single USB6363 DAQ.  The data needs to be polled by the .exe since the moment it needs the data is based on some other stuff the .exe is doing (actually it waits for stuff on the serial port, then goes and reads data from the DAQ).  It turns out the demand rate for each instance of the program is about 240 Hz, but it's not very consistent.  Finally, aside from reading analog values from the DAQ, I also need to write analog values from the DAQ, from a single source.  This would most likely need to be handled from a separate process anyway.

 

 

So I think there are two rough solutions:

1. Each instance of the Windows program accesses the DAQ on its own, when it needs, and doesn't worry about the rest of the world.  In this case I can envision a situation where the NI driver is being loaded down by multiple requests all for a single sample.  Even though 240 Hz is slow, it seems inefficient for the driver to handle requests from up to 6, 12, 18, or 24 hungry processes.  I'm not sure if the DAQmx drivers even support multi-process access.  To drive the analog values out, they would be completely unsynchronized, and come from a second .exe program that drives the stimulus.

 

2.  I have a separate server program that samples the DAQ at some very high rate and makes sure there is always some sample available for anyone to request.  I'm thinking of using 0MQ, but some other inter-process protocol would work too.  In this case the server could also drive the output so the output and input are synchronized.  This is a nice to have but not strictly required.

 

So the questions are:

1. Do the current DAQmx drivers for USB6363 support access from multiple processes for reads?  For writes?  etc.

2. If so, does managing 240 read requests per second, from 24 separate processes (5760 reads per second total) seem doable on a normal modern I7 laptop?

3.  What is the best way to get multiple processes to read data from the DAQ simultaneously?

 

thanks

 

0 Kudos
Message 1 of 3
(3,100 Views)

Hi RedmondUser

 

I believe that the link you found earlier at least has the proper architecture mentioned at the beginning. The problem is that you cannot make multiple calls to the DAQ at a time since the driver reserves resources being used by a program. If you try to make a call to a reserved resource, it doesn't wait until the resource is freed up to make a request, it will simply throw a resource reserved error. By creating a server that feeds the clients, I believe that you can get around this issue.

 

If you have any questions related to implementing this, feel free to post it to the forum!

 

Andy F.
Applications Engineering
National Instruments
0 Kudos
Message 2 of 3
(3,077 Views)

Thanks, yes I think that is correct architecture.  I'm in the process of making a little server that does just that.  There are other benefits too in that I can synchronize the stimulus with the measurement.

0 Kudos
Message 3 of 3
(3,075 Views)