Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Continuous Data Acquisition with Simulated Device

I'm having weird problems with continuous data acquisition using simulated device. When I read all available samples from the buffer using:

DAQmxReadAnalogF64(taskHandle, -1, 10.0, DAQmx_Val_GroupByScanNumber, data.get(), bufferSize, &numSamplesReadPerChannel, NULL);

I sometimes get gaps in the sine signal (see attachments). As I understand this call should return all available data from the buffer so gaps should not appear. When I perform the same read command with predefined sample amount (i.e. replace the -1 with some value) everything seems to work. I create my task using:

DAQmxCfgSampClkTiming(taskHandle,"", samplingRate, DAQmx_Val_Rising,DAQmx_Val_ContSamps, bufferSize));
DAQmxRegisterEveryNSamplesEvent(taskHandle,DAQmx_Val_Acquired_Into_Buffer, amountOfSamplesToSavePerIteration, 0, &onSamplesRead, this));

Is there an bug with my code or are the sine waves generated in such way that gaps appear with continuous acquisition?

Message Edited by SamiL on 08-07-2007 02:21 AM

0 Kudos
Message 1 of 2
(3,001 Views)
I was able to fix this issue by changing the sampsPerChanToAcquire value in the DAQmxCfgSampClkTiming call.
It previously had a value 4000000 which was a configuration error as the sampling rate was 20 kHz. When I dropped the value to 40 000 everything started to work with the simulated device.

I would like to know why the big buffer value causes apparent data loss at least with simulated devices? I was reading the whole buffer so no samples should escape.
0 Kudos
Message 2 of 2
(2,991 Views)