Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

How to distinguish samples from 6 different analog inputs

Solved!
Go to solution

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

0 Kudos
Message 1 of 3
(5,065 Views)
Solution
Accepted by topic author Khassan

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

Message 2 of 3
(5,039 Views)

Ok, I get it. Thank you.

 

Now I know that for my application I need ''DAQmx_Val_GroupByScanNumber" not "DAQmx_Val_GroupByChannel".

 

Regards,

Khassan

0 Kudos
Message 3 of 3
(5,030 Views)