Multifunction DAQ

Showing results for 
Search instead for 
Did you mean: 

NI M-series MIO random AI channel swapping



We are facing a continuous problem with analog acquisition on PCI 6251 and PCI 6221 MIO boards. The task is to createAO pulse series (specific number of identical pulses) and measure the response by two channel AI synchronously, but not each pulse. For example, AO pulse period is 20 ms (pulse duration about 1 ms), and AI measurements once in 200 ms, same duration as generated pulses. AI measurement should be aligned with AO pulse (measure exactly signle pulse). Also, we would like to be able to stop generation and acquisition at any number of cycles completed. For that we setup counter output with the desired frequency, setup start trigger for AO and AI by the counter output and then start both AO and AI tasks in two parallel loops. AO in simple for loop, because it is triggered each time by counter and AI in timed loop with required acquisition period. AO is from two channels, one of which is just connected to AO output, other one is grouned on BNC 2120 block.


The timing and triggering works perfectly. But AI0 and AI1 swaps at some number of cycles. Sometimes it is about 50, sometimes about 1000s. Change is usually one way. Only computer reboot or device reset help to revert channels back for a while. LabVIEW restart has no effect. Physical swappingis not a possibility - we doesn't touch BNC block at all, AO1 grounded by BNC terminator.


Simplified version of the block diagram is in atach as well as two screenshots before and after swapping. 


We have others application with similar AO output and two channels measurements (but one or small number of measurements in a cycle) and everything is perfect in them.


Playing around timed loop seems to have some effect on swapping. Inserting while loop instead of timed loop with wait until next function inside looks to be working.... for sometime. but than crashed again.


The problem is the same on two computers, 6251 and 6221 PCI boards. Windows XP SP3, LabVIEW 8.5.1, DAQmx 8.7.1f2

Following threads are looking to describe similar problems:,, but it seems to be no fix in them.


Thanks for any advice how to fix it. 

Download All
0 Kudos
Message 1 of 8



It seems like it would be better to just continuously read in all of the samples and only keep/use the ones that are important.


Constantly starting and stopping a task can cause some problems that is what each of the forums you listed are doing and this is not recommended coding.  What version of LabVIEW/DAQmx are you using?  Most importantly in the code below I notice that you are clearing all of the errors why is this?  What errors are occurring there?

timed loop.png

Jason Daming
Applications Engineer
National Instruments
0 Kudos
Message 2 of 8

Hi, Jason_D!


Thanks for the response!

Why starting and stopping task is not recommended? Is it in official manual or spec sheets? I didn't hear about this restriction previously... and didn't find any such problems for 5+ years using NI DAQs. For me it is the same as starting DAQ acquisition two or more times during one run of the program, ist'it? (we basically want to just start the same task more than once). Problems can occur as early as after 50 or so cycles.


There are seems to be no errors, but we will check this soon. (it is just prototype program, real reason is that stopping AO generation cycle will lead to timeout in timed loop and the error is trapped here). I agree that it is not correct.


I have written DAQ mx LabVIEW in previous post already: Windows XP SP3, LabVIEW 8.5.1, DAQmx 8.7.1f2.




0 Kudos
Message 3 of 8

We have checked the program for errors - there are no errors in the loop except the timeout when we stop while loop by "stop" button. Number of cycles to channel swap depends on the sampling period (smaller measurement period - more frequent swapping events by cycle number). We have collected some statistics by detecting channel swap, resetting the device automatically and starting over. The histogram is in attachement (for small cycle period, collected over 2h run).


We have recently received update to latest LV release and will try to test the same program on it (as well as latest DAQmx), as soon as IT guys will make it available.


Regards, Ivan

0 Kudos
Message 4 of 8



I apologize earlies about the last post I read your opening post in haste and not only missed the DAQ info but for some reason thought you were create and clearing your task inside the while loop. 


I have set up a test system here to reproduce the problem and I am looking for suggestions/differences between our setups specifically the connections.  I currently have a PCI 6251 as DEV 1 running your program.  I have used an SCB-68 to connect A0 to AI0 and Analog GND to AI8.  You say "AO1 grounded by BNC terminator." are you using AO1 in your program?  Is this behavior seen on both the 6251 and the 6221?


The initial test I ran was on my computer with Windows 7/DAQmx 9/LV 2009 and I was unable to reproduce it.  I will set up a system similar to yours soon.


Here is a video of what I have.



Jason Daming
Applications Engineer
National Instruments
Message 5 of 8



Thank you for your efforts to reproduce the problem.

Sorry, AO1 is a typo. I mean AI1. AI0 is connected on BNC block to AO0 by BNC cable. AI1 is short-circuited on BNC block (this really doesn't mater - in real app we have connected it to external source).

Behavior on 6221 and 6251 is same. 

We have also tested recently purchased USB 6251 with BNC terminals but have not been able to reproduce behavior on "DAQmx 8.x Win XP, LV8.5.1" as well as on "W7,  DAQmx 9, LV2009". We will try to insert PCI card inside the machne with LV2009 and test on it. Probably tomorrow. 



0 Kudos
Message 6 of 8
Oops... Sorry, this message was not intended.
Message Edited by Baturin on 01-28-2010 06:48 AM
0 Kudos
Message 7 of 8



We have tested PCI 6251 on a machine with windows 7, LV2009 and DAQmx 9. It seems to be working smoothly without channel swapping. I hope the problem will go off as we start to deploy W7 workstations with latest NI software installed.

Thank you for the support!

0 Kudos
Message 8 of 8