Hello all,
I am building an application where a daqmx task fills continuously at high speed a buffer. I have define a buffer of 8k samples/channel. The acquisition is four channels ai0:3.
The OS (Windows) is slower an irregular. So I use the buffer with overwrite.. And each time that I can process data, I get the most recent sample from the buffer.
With simulated devices (including simulated PCI-6110) this seems to work fine. With DAQPad-6015 as real hardware, this seems to work fine. But when moving the release application to a computer with a PCI-6110, it gives a task error after (approximate) 2048 samples are shown in a stripchart.
The error message is unclear, code -88709 referring to a task handle that does not exist (anymore).
Part of the code for gSamplesPerChannel = 1:
DAQmxErrChk (DAQmxCreateTask("",&gTaskHandleInput));
DAQmxErrChk (DAQmxCreateAIVoltageChan(gTaskHandleInput,chan,"",DAQmx_Val_Cfg_Default,min,max,DAQmx_Val_Volts,NULL));
DAQmxErrChk (DAQmxCfgSampClkTiming(gTaskHandleInput,NULL,rate,DAQmx_Val_Rising,DAQmx_Val_ContSamps,gSamplesPerChannel));
DAQmxErrChk (DAQmxCfgInputBuffer (gTaskHandleInput, 8196));
DAQmxErrChk (DAQmxSetReadAttribute (gTaskHandleInput, DAQmx_Read_OverWrite, DAQmx_Val_OverwriteUnreadSamps));
DAQmxErrChk (DAQmxSetReadAttribute (gTaskHandleInput, DAQmx_Read_RelativeTo,DAQmx_Val_MostRecentSamp));
DAQmxErrChk (DAQmxSetReadAttribute (gTaskHandleInput, DAQmx_Read_Offset, -1 * gSamplesPerChannel));
DAQmxErrChk (DAQmxRegisterEveryNSamplesEvent(gTaskHandleInput,DAQmx_Val_Acquired_Into_Buffer,gSamplesPerChannel,0,ScopeModeSingleSampleCallback,NULL));
DAQmxErrChk (DAQmxStartTask(gTaskHandleInput));
and the callback for each N=gSamplesPerChannel=1 samples uses:
DAQmxErrChk (DAQmxReadAnalogF64 (taskHandle, nSamples, 10.0,DAQmx_Val_GroupByChannel, dData, nSamples*gNumChannels, &numRead, NULL));
From the task error near 2038 samples, it seems as if the PCI-6110 interface dumps the samples from all four channels in a single-channel buffer and simultaneously thinks that it has the full 8196 for each channel. As I do not get this error with simulated PCI-6110, and as I cannot move the full development CVI license to the real hardware PCI-6110, it is difficult to find the cause for the error.
Q:
Does anybody see an obvious mistake in the code, or
does the buffering work different for a non-multplexed A/D device, or
who can help me otherwise ?
Regards, Jos