Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

first AI channel in the same task is off by 1 sample

Hi,

 

When acquiring data from multiple analog input channels belonging to the SAME task, I observed that AI0 is always 1 sample behind all other AI channels. This behavor does not seem to be affected by the sample rate.

 

This behavior was observed using NI USB-6255, NI PXIe-6251, and NI USB-6211 devices (all M series) - and using NIDAqmx driver version 9.8.0f0 on a Windows 64 bit machine.

 

To reproduce, create a task containing multiple AI channels. Hook all AI channels to the SAME signal (I used a function generator to send a 2KHz Sine Wave). I would expect all AI channels to be synchronized, and hence all sample points to closely match. At first I thought maybe some of teh above devices exihibted this behavior because they do not support simultaneous sampling, but then - why would only AI0 be off while the rest of the AI channels are good... further, why by a complete sample point.

 

To easily reproduce, you can use NI MAX explorer, select one of the above devices (e.g. NI USB-6211), Create a Task, Acquire Signals of type Voltage on AI0, AI1, AI2. Set to Single Ended, and make sure all channels are connected to the same 2KHz FGen Sinusoid. Set the acquisition mode to continuous, set the rate high to better see the issue (e.g. 83300 for the NI USB-6211). Observe problem (see attached screen capture).

 

Thanks,

Wael Hemdan

MathWorks

 

 

0 Kudos
Message 1 of 4
(3,938 Views)

Hi Wael,

 

Thanks for the question. I was able to reproduce similar behavior. Are you sure that it is off by exactly one sample, or is it a general time lag?

National Instruments
0 Kudos
Message 2 of 4
(3,863 Views)

Hi,

 

Thank you for your reply.

Yes, I've confirmed that it is off by exactly one sample. If I shift AI 0 by this one sample, the signals overlap exactly.

 

Regards,

Wael Hemdan

MathWorks

 

0 Kudos
Message 3 of 4
(3,853 Views)

@whemdan wrote:

 

I would expect all AI channels to be synchronized, and hence all sample points to closely match. At first I thought maybe some of teh above devices exihibted this behavior because they do not support simultaneous sampling, but then - why would only AI0 be off while the rest of the AI channels are good... further, why by a complete sample point.

  


 

The delay between channels is one period of the convert clock.  In your example (83.3 kHz sample rate, 3 channels, USB-6211) the convert clock rate would default to 250 kHz, so that would be 4 us between channels.

 

The only way that I can imagine this giving the behavior you described is if you were updating the function generator using the AI sample clock (or using the function generator's clock as the AI sample clock).  By default the first convert clock edge occurs 3 timebase ticks (150 ns using the 20 MHz timebase) after the AI sample clock, so that would give each channel the following delay relative to the sample clock:

 

AI0: 0.150 us

AI1: 4.150 us

AI2: 8.150 us

 

 

I'm not sure of the specs of your FGEN, but if you are sampling at 150 ns after the update begins I'd imagine the output voltage would still be much closer to the original value and so the acquired data would appear one sample behind.

 

 

If this isn't the issue, then I'm not really sure what else it could be--if you describe your experiment in more detail perhaps something might jump out.

 

 

Best Regards,

John Passiak
0 Kudos
Message 4 of 4
(3,846 Views)