01-14-2013 02:02 PM
Hello,
I just started programming Daqmx. I found the example "ContAcq-IntClk.c" which I modified for my PXI System. My problem is I need to read several channels at the same time. Can someone help me to change the lines for reading something like PXI1Slot2/ai0:2 and store it in an array in any way I can use it for further purpose?
01-17-2013 03:21 AM - edited 01-17-2013 03:27 AM
Hi akirahinoshiro,
A little info:
DAQmxCreateAIVoltageChan(taskHandle, "PXI1Slot2/ai0:3", "", DAQmx_Val_Cfg_Default, -10.0, 10.0, DAQmx_Val_Volts, NULL);
-> "ai0:3" means that you scan 4 channels simultaneously.
DAQmxReadAnalogF64(taskHandle, 1000, 10.0, DAQmx_Val_GroupByScanNumber, data, 1000, &read, NULL);
-> "data" array contains the acquired values. DAQmx_Val_GroupByScanNumber means that the data structure is interleaved i.e.: ch0;ch1;ch2;ch3;ch0;ch1;ch2;ch3... etc.
If you set 3 channels (for example "ai0:2") you must take care of buffer size 'cause the acquired data must fit into the buffer.
If you don't need dozens of callbacks per second, you can increase the buffer size and the nSamples variable in DAQmxRegisterEveryNSamplesEvent function. (In the attached sample code the sampling rate is 100 kHz!).
Good luck,
- George Cs. -