Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

daqmx ansi c multiple analog input

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?

0 Kudos
Message 1 of 2
(3,202 Views)

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. -

0 Kudos
Message 2 of 2
(3,169 Views)