We are creating our application using NIDAQmx API and I would like to make sure that I have understood certain basic concepts. If we have to channels and we need to sample them 500 kHz for each channel we can do it by following call:
DAQmxCfgSampClkTiming(taskHandle,"", 2*500000, DAQmx_Val_Rising, DAQmx_Val_ContSamps, 10*2*500000));
When samples for both of the channels have been read, we want a callback to be called:
DAQmxRegisterEveryNSamplesEvent(taskHandle, DAQmx_Val_Acquired_Into_Buffer, 2*500000, 0, &onSamplesRead, this));
In our read callback we can get the samples using:
long __cdecl onSamplesRead(TaskHandle taskHandle, int32 everyNsamplesEventType, uInt32 nSamples, void *callbackData) {
...
bufferSize = 2000000;
DAQmxReadAnalogF64(taskHandle,2*500000,10.0,DAQmx_Val_GroupByChannel, data.get(), bufferSize, &read, NULL)
...
}
Are we doing everything correctly or is there some error in the sampling rates?