Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I read multiple AI channels sequentially with DAQmx?

The DAQmxReadAnalogF64() function appears to read multiple channels as ch0/sample0, ch1/sample0,ch0/sample1,ch1/sample1,..., thus the maximum sample rate for each channel is the device's maximum sample rate divided by the number of channels.

I wish to read ch0/sample0,ch0/sample1,...ch0/sampleN, ch1/sample0,ch1/sample1,...ch1/sampleN.  I do not need psuedo-simultaneous sampling, rather I need to utilize the maximum sample rate of the device for each channel. Since DAQmx cannot have multiple tasks performing analog input, I have tried using n tasks (one for each channel) that are alternated sequentially between the run state and the verified state, but the time taken to transition the task from the verified to the run state causes the lag between channels to be unacceptable.

In traditional DAQ I could use the AI_Read() function to read each channel's data separately. What is the DAQmx way of accomplishing this?


0 Kudos
Message 1 of 5
(3,813 Views)
 

Jaybus,

You mentioned that you are not concerned with simultaneous sampling.  If this is true, you can try to dynamically create your channels.  You can call create channel n times for m input channels and add these channels to the same task.  After you have added all of your channels, you can call the read and it will read n samples on channel m, n samples on channel m+1, etc.  Again, this will not be simultaneous data. 

Regards,

L. Allen

0 Kudos
Message 2 of 5
(3,788 Views)

I have a DAQCard 6062E that has an aggregate sample rate of 500 kS/s. I want to sample ch0 at the maximum 500 kS/s, then sample ch1 at 500 kS/s, then sample ch2 at 500 kS/s, etc. I was under the impression that DAQmxReadAnalogF64() performed the more usual multiplexed scan, where the aggregate sample rate is 500 kS/s, but the effective sample rate for each channel is 500 kHz divided by the number of channels scanned. Are you saying that there is a way to sample each channel at the maximum sample rate (as if it were the only channel being scanned)?


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

To an extent.  This is not an officially supported method so there is no guarantee that you will be able to get the 500k on ecah channel.  But, you should be able to configure the task as stated above and achieve a NON-simultaneous acquisition that should be a bit quicker than the way you were doing it with different tasks for each channel. 

Regards,

L. Allen

0 Kudos
Message 4 of 5
(3,760 Views)
Thanks L. I think this will indeed work better, even if I have to back the sampling rate down some.
0 Kudos
Message 5 of 5
(3,748 Views)