Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Missing function in DAQmx/Base

Since there is no NIDAQ traditional support for the USB-6008 I had to port an existing application using the functions available in NIDAQmxBase.
Unfortunately both the NIDAQmx and NIDAQmxBase allow no asynchronous reads. If the DAQmxBaseReadAnalogF64() is started the program is waiting until the function completes. There is no way to stop this task before the function completes. I tried to put DAQmxBaseReadAnalogF64() in a thread, but killing the thread does not terminate the task correctly.
I miss the equivalents of the functions SCAN_Start(...), DAQ_Check(...) and DAQ_Clear() of NIDAQ traditional. Due to the lack of these functions it is almost impossible to develop complex applications using NIDAQmx and NIDAQmxBase. It would be a good idea to realize these functions in the coming versions of NIDAQmx/Base.
0 Kudos
Message 1 of 16
(4,270 Views)

@Gallus wrote:
Unfortunately both the NIDAQmx and NIDAQmxBase allow no asynchronous reads.



NI-DAQmx certainly does support asynchronous reads and has equivalent or better functionality of Traditional DAQ in this regard (I don't know enough about NIDAQmxBase to know if it has this functionality, but DAQmx does for sure).

Here are the equivalent DAQmx functions:

SCAN_Start == DAQmxStartTask (after calling DAQmxCfgSampClkTiming)
DAQ_Check == get the DAQmx_Read_AvailSampPerChan attribute using the DAQmxGetReadAttribute function
DAQ_Clear == DAQmxStopTask or DAQmxClearTask
0 Kudos
Message 2 of 16
(4,253 Views)


@JoeSavage wrote:

@Gallus wrote:
Unfortunately both the NIDAQmx and NIDAQmxBase allow no asynchronous reads.



NI-DAQmx certainly does support asynchronous reads and has equivalent or better functionality of Traditional DAQ in this regard (I don't know enough about NIDAQmxBase to know if it has this functionality, but DAQmx does for sure).

Here are the equivalent DAQmx functions:

SCAN_Start == DAQmxStartTask (after calling DAQmxCfgSampClkTiming)
DAQ_Check == get the DAQmx_Read_AvailSampPerChan attribute using the DAQmxGetReadAttribute function
DAQ_Clear == DAQmxStopTask or DAQmxClearTask




And the answer to "I don't know enough about NIDAQmxBase to know if it has this functionality" is that DAQmx Base has no support for getting attributes, at least in C code.
John Weeks

WaveMetrics, Inc.
Phone (503) 620-3001
Fax (503) 620-6754
www.wavemetrics.com
0 Kudos
Message 3 of 16
(4,246 Views)
Thanks for your reply.

I have installed the latest versions of NIDAQmx (version 7.4.0.f0) and NIDAQmxBase (version 1.4.0f2).

NIDAQmx:
The DAQmxGetReadAttribute() function is not documented in the online documentation.
Is that an undocumented function or do you use an other version of NIDAQmx?

NIDAQmxBase:
Has no DAQmxGetReadAttribute() function.
(John Weeks has already answered this..)

Regards

Bela Torok
0 Kudos
Message 4 of 16
(4,230 Views)
You can use DAQmxGetReadAvailSampPerChan() instead. The DAQmxGetReadAttribute() function is a generic "read" property accessor that is currently undocumented, but whose prototype can be found in the nidaqmx.h header file. There are other read properties in DAQmx that might be useful to you as well, such as current read position and total samples per channel acquired. These properties have their own accessor functions, and can also be retrieved from the generic DAQmxGetReadAttribute() function.

--Joe

Message Edited by JoeSavage on 04-08-2005 01:37 PM

0 Kudos
Message 5 of 16
(4,215 Views)
Documentation other than that found by digging through NIDAQmx.h would be nice.
0 Kudos
Message 6 of 16
(4,206 Views)
To be clear about it, the only undocumented function that I referred to is the DAQmxGetReadAttribute() function. The other properties that I mentioned have documented accessor functions, so there isn't a need for you to use the DAQmxGetReadAttribute() function. I'm sorry I brought it up in the first place. Most likely, the reason that function is not documented is to avoid customers getting confused with multiple ways of accessing properties. Now, I've up and confused everybody.

So, use the properly documented read property accessor functions, and forget that I mentioned the DAQmxGetReadAttribute() function (as well as all of the DAQmxGet[x]Attribute and DAQmxSet[x]Attribute functions).
0 Kudos
Message 7 of 16
(4,199 Views)


@JoeSavage wrote:
To be clear about it, the only undocumented function that I referred to is the DAQmxGetReadAttribute() function. The other properties that I mentioned have documented accessor functions, so there isn't a need for you to use the DAQmxGetReadAttribute() function. I'm sorry I brought it up in the first place. Most likely, the reason that function is not documented is to avoid customers getting confused with multiple ways of accessing properties. Now, I've up and confused everybody.

So, use the properly documented read property accessor functions, and forget that I mentioned the DAQmxGetReadAttribute() function (as well as all of the DAQmxGet[x]Attribute and DAQmxSet[x]Attribute functions).




But properties are still not available in NI-DAQmx Base.
John Weeks

WaveMetrics, Inc.
Phone (503) 620-3001
Fax (503) 620-6754
www.wavemetrics.com
0 Kudos
Message 8 of 16
(3,687 Views)
My previous posts only applied to DAQmx. However, to address the original post, with DAQmxBase you can perform a read with a zero timeout, which will cause the read to return quickly if the data to be read is not available. Now, while this is not the equivalent functionality of DAQ_Clear(), you can implement an asynchronous read by using this feature.

Joe
0 Kudos
Message 9 of 16
(3,674 Views)
Except see my thread: http://forums.ni.com/ni/board/message?board.id=250&message.id=11016

At least on Macintosh, a timeout of zero is not reliable (until the fix Malcolm has promised comes through).
John Weeks

WaveMetrics, Inc.
Phone (503) 620-3001
Fax (503) 620-6754
www.wavemetrics.com
0 Kudos
Message 10 of 16
(3,653 Views)