LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

daqmx buffer DAQmx_Val_ContSamps PCI-6110

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
 
  
0 Kudos
Message 1 of 4
(4,396 Views)
Hi Jos,
 
I think this behaviou is caused by the onboard FIFO on the device, this is exactly 8192 samples, the same as your memory buffer. It looks like this is causing a problem with the extual data transvers over the PCI bus and resulting in an exception within the driver.
 
Could you try and change your buffer size to for example 10k Samples?
 
Thanks
Karsten
0 Kudos
Message 2 of 4
(4,372 Views)

Hello Karsten,

 

I have changed the buffer to 10k. But I have only access to the hardware at the beginning of next week. So there are no results yet !

Meanwhile, if anybody else has ideas to test ... ...

Thanks, Jos

 

0 Kudos
Message 3 of 4
(4,360 Views)

Hello Karsten,

I changed the buffer size to 12k. This did not stop the errors nor did I get sufficient information on the cause of the error.

Afterwards I moved the device (PCI interface) to the computer where I develop applications. There I get no errors. As the 'original' computer has less memory and has half the CPU speed, I suspect some build-up of callback on EveryNSample. And my own computer can handle this, although the EveryNSample callback frequency is higher than the loopcounter/second that displays the processing of this callback.

So the message is: new computers and memory are cheap. Don't spend days on an old slow computer when you try for medium-high acquisition and processing speed.

 

Thanks, Jos

 

0 Kudos
Message 4 of 4
(4,309 Views)