Example Programs

Showing results for 
Search instead for 
Did you mean: 

Read Multiple Channels Sequentially Using DAQmx


In some circumstances, when using a multiplexed multifunction DAQ device it may be desirable to acquire from a single channel at a time, but use the multiplexer to switch between channels only after a certain number of samples have been acquired on each channel.  This example shows how to configure a Multiplexed multifunction DAQ to operate in this manner--you can think of it like a switch combined with a single channel data acquisition device.


The key is that you can scan the same channel multiple times in a scan list--the program takes advantage of this and builds a task with multiple copies of each desired channel.  This way we can configure the amount of samples we want on each channel, and multiplex to the next channel on the very next convert clock pulse.  The sample clock is used as a "trigger" signal to start the entire acquisition over again.  You may use an external digital trigger if desired to re-start the acquisition, but you would have to configure this as your sample clock (NOT as a trigger).

This is a VERY specific use case for DAQmx, so for more general examples you should take a look at the shipping examples in the LabVIEW Example Finder.



  • LabVIEW 2009 or compatible
  • NI DAQmx 9.1.5 or compatible


  • Any DAQmx-supported hardware that multiplexes samples to a single ADC (M Series, some X Series).

Steps to Implement or Execute Code

  1. Open VI.
  2. Set channel scanning parameters.
  3. Run VI.

Additional Information or References

Front Panel


VI Snippet

Sequential Channel Read.png

**This document has been updated to meet the current required format for the NI Code Exchange.**

John Passiak
Trusted Enthusiast
Trusted Enthusiast

Example previously used Hardware Timed Single Point for some reason--I changed it to Continuous.

John Passiak
Member Ibn7alal

Hi John,

First of all, thank you for your insightful comments across so many threads.  I am finding most of the answers to my questions through the discussion forum with your replies. As far as the example above, however, I don't understand how you are able to read multiple channels sequentially.  As far as I understand, you are defining a number of instances for a single channel that is equal to the "number of samples" control in the front panel.  I am having trouble understanding the benefit of this VI. Can you explain the advantage of this VI?

I am indeed looking for a way to read multiple (60) channels sequentially.  If I understand correctly, the benefit of following this route is that we are able to use the full maximum sampling rate for each channel as opposed to having a sampling rate that is equal to the max sampling rate divided by 60.  Is that correct? 

Our system has 60 analog input signals that are all sinusoidal waves. However, these inputs have a slightly different phase from each other.  The phase is very important for our application.  Therefore, my plan is to acquire a single data input (a single sinusoid wave) along with a single reference input.  Once I collect all 60 data inputs, each with the same reference input, I plan to align the signals so that I can get the phase difference between each input and the reference channel.  This way, I will be able to get the phase difference between all the channels while still having a high sampling rate. 

I would love to hear your thoughts.  Any feedback?  Do you have any other suggestions?  Thanks in advance.

Keep up the amazing work.

Best wishes

Trusted Enthusiast
Trusted Enthusiast

Hi Ibn7alal,

Here are the reasons I can think of why you might want to use this VI:

1.  The settling error due to switching between channels on every sample might be an issue for some applications.  Here is an example of a customer using this method to sample multiple times on each channel, and average the samples together to reduce noise.  The method of sampling each channel sequentially is preferential in this case since only the first few samples (which can be thrown out) are affected by settling error.

2.  Originally, I had made this VI for a customer who was using an SCXI module which had a built-in multiplexer with a limited number of switches.  The customer did not need to switch between every sample, since the SCXI Multiplexer had a limited number of lifetime switches.  Implementing their program in this way greatly extended the lifetime of their hardware.

3.  Your application might require sampling each channel at the maximum rate, but you don't have to sample them simultaneously.  Programming in this method allows for the minimum delay between changing which channel to sample (compared to restarting the task with a different channel).

You'll want to sample at the maximum possible rate to get the best resolution, and doing so requires you to sample the data inputs sequentially.  The only benefit of using this method that I can see is that you wouldn't need to restart your task in software repeatedly.  However, if it takes a few ms to restart each task, doing this would add less than a second of delay to your code--and you wouldn't have to program in the above fashion which adds quite a bit of complexity.  I'd probably recommend against it to start out--if it turns out that restarting tasks takes too long for your application you can modify your code and work from there.

John Passiak
Member Ibn7alal

Hi John,

Thanks again for your input.  This has cleared many issues in my head.  Does the acuisition in this case (in the example VI) follow the round-robin scanning method since your are manually setting the AI convert clock? 

Best wishes

Active Participant Ting1224
Active Participant

Hi John

I rewrite your code a little bit. Check if this is what you want.




Trusted Enthusiast
Trusted Enthusiast

Hi Ting,

This could be useful as a finite or a continuous task, there's no harm in changing it to Finite.

Best Regards,


John Passiak