Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Missing function in DAQmx/Base



@JoeSavage wrote:
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



> Joe Savage Wrote:
>DAQ_Check == get the DAQmx_Read_AvailSampPerChan attribute using the DAQmxGetReadAttribute function

Tahns for your reply!

The DAQmx version of the program works now with the DAQmxGetReadAttribute(...) function properly.

DAQmxCreateAIVoltageChan(ADtaskHandle, ...., NULL);
DAQmxCfgSampClkTiming(ADtaskHandle, ...);
DAQmxStartTask(ADtaskHandle);

DAQmxGetReadAttribute(ADtaskHandle, DAQmx_Read_AvailSampPerChan, &read, NULL);
loop_start:
if(read != sampsPerChanToAcquire) Do_Something();
loop_end:

iStatus = DAQmxReadAnalogF64(ADtaskHandle, ....);

The DAQmxBase version of the program is still not working. There is no DAQmxGetReadAttribute(...) function in the DAQmxBase library.

> Joe Savage wrote ()04-08-2005):
> 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.

This approach not work, the following code generates an error.

DAQmxBaseCreateAIVoltageChan(ADtaskHandle, ...., NULL);
DAQmxBaseCfgSampClkTiming(ADtaskHandle, ...);
DAQmxBaseStartTask(ADtaskHandle);

loop_start:
iStatus = DAQmxBaseReadAnalogF64(ADtaskHandle, sampsPerChanToAcquire, 0, DAQmx_Val_GroupByChannel, AD_Buffer, required_reads, &read, NULL);
if(iStatus != 0) Beep(100, 1000);
if(read != required_reads) Do_Something() 0;
loop_end:

I wanted to solve the problem with the DAQmxBaseIsTaskDone() function like this:

DAQmxBaseCreateAIVoltageChan(ADtaskHandle, ...., NULL);
DAQmxBaseCfgSampClkTiming(ADtaskHandle, ...);
DAQmxBaseStartTask(ADtaskHandle);

DAQmxBaseIsTaskDone(taskHandle, &isTaskDone);

loop_start:
if(isTaskDone == 0) Do_Something();
loop_end:

iStatus = DAQmxBaseReadAnalogF64(ADtaskHandle, ....);

The problem is with this code that the DAQmxBaseIsTaskDone() function after starting the data acquisition task returns a 0x1 value (task done?).

I am new to DAQmx and DAQmxBase, have no experience but for me this looks like a bug.
To my opinion the isTaskDone variable should turn to 0x1 only after completing the data acqusition task.

Regards:

Bela Torok
0 Kudos
Message 11 of 16
(1,863 Views)
Galus wrote:

> The problem is with this code that the DAQmxBaseIsTaskDone() function after starting the
> data acquisition task returns a 0x1 value (task done?).

I don't know about Linux, but on Macintosh OS X, the release notes for NI-DAQmx Base say that DAQmxBaseIsTaskDone() has not been implemented for analog input. Since the whole point of DAQmx Base is to use cross-platform Labview code, it would seem likely that this restriction applies also to Linux.

In fact, I have been down this road of wanting to make partial reads. See the thread "Mac OS X DAQmx Base error -200284; unreliable scanning":

http://forums.ni.com/ni/board/message?board.id=250&message.id=11016
John Weeks

WaveMetrics, Inc.
Phone (503) 620-3001
Fax (503) 620-6754
www.wavemetrics.com
0 Kudos
Message 12 of 16
(1,818 Views)
John Weeks wrote:

> I don't know about Linux, but on Macintosh OS X, the release
> notes for NI-DAQmxBase say that DAQmxBaseIsTaskDone() has
> not been implemented for analog input.

This limitation is not documented in the online C Function Reference Manual! It would be a good idea to implement this for the analog input too, otherwise renaming the DAQmxBaseIsTaskDone function to DAQmxBaseIsAOTaskDone would be fine. This also applies to NIDAQmx.

The name NIDAQmxBaseIsTaskDone suggest that this function call can be used with every implemented tasks.

I use the Windows version of NIDAQmxBase...

> http://forums.ni.com/ni/board/message?board.id=250&message.id=11016

Thanks for this link!

Regards:

Bela Torok
0 Kudos
Message 13 of 16
(1,795 Views)
NI-DAQmx Base 1.5 should incorporate this fix.
0 Kudos
Message 14 of 16
(1,225 Views)


@Jeremy C wrote:
NI-DAQmx Base 1.5 should incorporate this fix.




Excellent! Thank you, Jeremy.
John Weeks

WaveMetrics, Inc.
Phone (503) 620-3001
Fax (503) 620-6754
www.wavemetrics.com
0 Kudos
Message 15 of 16
(1,218 Views)
Jeremy C. wrote:
> NI-DAQmx Base 1.5 should incorporate this fix.

NIDAQmxBase 1.5 does not solve my problem.

1. DAQmxBaseIsTaskDone() is still not supporting the analog input (This is documented in the NIDAQmxBasePCReadme.html file)

2. DAQmxBaseReadAnalogF64() is still not working with zero timeout.

3. The functions DAQmxBaseGetReadAvailSampPerChan() and/or DAQmxBaseGetReadAttribute() functions are still not implemented.
These functions are not existing in the nidaqmxbase.lib file, uncommented function declarations are existing in the NIDAQmxBase.h file.

Regards:

Bela Torok
0 Kudos
Message 16 of 16
(1,206 Views)