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.

Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

non blocking read

Solved!
Go to solution

Hi

 

I am trying to implement a non-blocking read along the lines of peekdata() in matlab http://www.mathworks.de/access/helpdesk/help/toolbox/daq/index.html?/access/helpdesk/help/toolbox/da...

 

I found that I can do non-blocked reads using read + callbacks http://forums.ni.com/ni/board/message?board.id=230&thread.id=2862

 

Is there another way to achieve non-blocking reads?   The reason is that if i implement the above using matlab's mex interface, Matlab calls the (mex) C file and i have to do the read (has to wait for the trigger to happen) before returning back from the C file (aka again it becomes blocking). So callbacks are not really useful if thought in a single-threaded way that matlab works.

 

thanks for reading. 

0 Kudos
Message 1 of 3
(3,284 Views)
Solution
Accepted by topic author titanius
The way that the driver is written is to block on a DAQmx read.  In a single threaded method this will always be a blocking call as far as I know.
Doug Farrell
Solutions Marketing - Automotive
National Instruments

National Instruments Automotive Solutions
0 Kudos
Message 2 of 3
(3,265 Views)

Thanks a lot.

 

I was able to get around implementing a non-blocking read in mex was via two threads, one always reading in the background and the other polling it.

 

 

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