11-19-2012 06:03 AM
Hello everyone, I am still new to NI-DAQmx. I am writing a program in C++ that reads 6 analog inputs from PCI-6220 card.
Basically, I created 6 virtual channels in a single task, it looks like I am acquiring all required inputs.
However, problem is I don't know which sample is coming from which analog input channel. I set fill mode to 'DAQmx_Val_GroupByChannel'.
Please help me, how can I distinguish samples from different analog inputs.
Best regards from Kazakhstan,
Khassan
Solved! Go to Solution.
11-20-2012 03:12 PM
Khassan,
The channel order would be decided in the order in which you added your channels to the task. So lets say I create a task and add three channels and add them in the order ai0, ai1, and ai2. If I configure the fill mode to 'DAQmx_Val_GroupByChannel', DAQmxRead will copy data into 'readArray' such that the data for ai0 is all together, followed by the data from ai1, which is followed by the data from ai2. The size of each of these sections of the buffer should be returned via the 'sampsPerChanRead' argument to read. So if were to call read, and DAQmx returned 5 for 'sampsPerChanRead', then my data buffer would look like this:
ai0, ai0, ai0, ai0, ai0, ai1, ai1, ai1, ai1, ai1, ai2, ai2, ai2, ai2, ai2
Hope that helps,
Dan
11-20-2012 09:40 PM
Ok, I get it. Thank you.
Now I know that for my application I need ''DAQmx_Val_GroupByScanNumber" not "DAQmx_Val_GroupByChannel".
Regards,
Khassan