@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.
--JoeMessage 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