I am using NI DAQmx base on RedHat Linux 9.0.
I am acquiring 4 signals on a PCI6143 card.
Right now, I believe I am capturing the signals simultaneously, storing the results into a buffer, then chopping that buffer into 4 data structures (to separate each channel).
What I would like to do is to have this capuring go for a prolonged period of time, and then dump the results to 4 text files. I am not sure what the best approach for this would be. Obviously, I have a limit to the size of the buffer, so I cannot simply capture enough data to the buffer, then write it out.
It would be nice if there was some sort of double buffering approach, similar to graphics programming. I could capture to buffer 1, and when it is full, start capture to buffer 2, and while that is working, write buffer 1 to a file, then when buffer 2 is full, start capture to buffer 1 and write buffer 2 to the file, and so on.
Has anyone done anything like this? I am using the C libraries, so labview code wont help me.
Also, is this doing a simultaneous capture?
char chan[] = "Dev1/ai0:3";
float64 min = -5.0;
float64 max = 5.0;
float64 sampleRate = 250000.0;
#define bufferSize (uInt32)4000
#define samplesPerChannel (uInt32)1000
float64 data[bufferSize];
...
DAQmxErrChk (
DAQmxBaseCreateAIVoltageChan (
taskHandle,
chan,
"",
DAQmx_Val_Diff,
min,
max,
DAQmx_Val_Volts,
NULL)
);
DAQmxErrChk (
DAQmxBaseCfgSampClkTiming (
taskHandle,
source,
sampleRate,
DAQmx_Val_Rising,
DAQmx_Val_ContSamps,
samplesPerChannel)
);
DAQmxErrChk (
DAQmxBaseReadAnalogF64 (
taskHandle,
pointsToRead,
timeout,
DAQmx_Val_GroupByScanNumber,
data,
bufferSize,
&pointsRead,
NULL)
);