Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

What happened to continuous analog input callbacks in NIDAQmx?

I'm writing a C++ application that reads analog input continuously. I'm using NI-DAQmx for the first time rather than Traditional NI-DAQ.

I could configure Traditional NI-DAQ to inform me via a callback function when half a buffer's worth of input had arrived, but I cannot see how to do this with NI-DAQmx. Does NI-DAQmx not support this mode of input? I can use DAQmxReadAnalogF64 to read input, but it ties up the CPU waiting for the requested input to arrive, which the callback mechanism didn't. If the callback input mode is gone, how can I read continuous input using NI-DAQmx without tying up my CPU? If necessary I can start my own thread that periodically checks to see if enough input has arrived to just
ify a read, sleeping inbetween checks, but if NI-DAQmx can do something like this for me I'd rather not.

Thanks!
0 Kudos
Message 1 of 3
(4,314 Views)
Hi Harold,
Currently, the DAQmx library does not contain asynchronous reads.

Are you using MeasurementStudio?
If you are, then you can use the asynchronous Read functions that are available in MeasurementStudio's DAQmx library.
Typically, asynchronous Reads (and Writes) are named similar to the Synchronous ones, except that they end in "async". You can look at C:\Program Files\National Instruments\MeasurementStudio70\VCNET\Examples\DAQmx\Analog In\Measure Voltage\ContAcqVoltageSamples_IntClk for an example.
Most of the "Continuous" acquisition examples will use the asynchronous reads.
If you have MeasurementStudio and DAQmx 7.3, then you will also find a help topic ms-help://MS.VSCC.2003/NI.MeasurementStudio/NIVCDAQmxConcept/static/Asynch_ReadWrite_DAQ.html


If you are using the C library then you do not have any asynchronous operations available in the DAQmx library, and so you will have to create your own worker thread, in which you can carry out your read, and thus keep the UI responsive. Essentially, this is what MeasurementStudio's async methods do for you.
Nandan Dharwadker
Staff Software Engineer
Measurement Studio Hardware Team
0 Kudos
Message 2 of 3
(4,311 Views)
I've just converted some old tradition nidaq to DAQmx using Borland C++.  Have you looked at DAQmxRegisterEveryNSamplesEvent? You then do the ReadAnalogF64 inside the callback which will suceed immediately as you know the samples are there.

To me, it provides the same functionality as the old callback mechanism.

Cheers

Russell
0 Kudos
Message 3 of 3
(3,971 Views)