03-28-2011 01:17 PM
I'm using a PCI-6221. I have an application that outputs 2 waveforms (finite samples) and simultaneously records 4 channels of analog input. I'm using the AO sample clock as the sample clock for the analog input.
As a test I connected the first AO channel (AO0) to all 4 inputs. What happens when I run the vi is that the first sample on the first channel (AI0) has the value of the last sample that was output on AO0, from the previous generation.
Example:
AI0 AI1 AI2 AI3
-0.369 -0.001 -0.001 -0.001
-0.001 0.062 0.062 0.062
0.062 0.124 0.124 0.124
etc.
I figured out that it's an issue with the relative times of AO update and AI sampling.
It must be going: read AI0 / write AO0 / read AI1 / read AI2 / read AI3.
I'm using DAQmx Timing (Sample Clock) to specify the AO clock as the sample clock for the AI. I noticed that this has an input terminal called active edge. Aha, I thought - if I set the active edge to negative the AI will always start sampling half a clock cycle after the AO has updated. Wrong. It makes absolutely no difference. Maybe the AO clock signal is a very short pulse?
Is there a way to specify the order in which analog outputs and inputs update / sample?
Solved! Go to Solution.
03-29-2011 12:27 AM
Hi CDancer,
Changing the analog output voltage isn't instantaneous. It depends on the board's slew rate and the difference from the previous voltage.
You're right that the AO sample clock is a very short pulse. As far as I remember, it's on the order of 50 ns.
Here are two ways to insert a delay between the AI and AO tasks:
Brad
03-29-2011 04:22 AM
Thanks Brad. Setting the AI conversion delay to 10 microseconds causes all AI values to be about the same on every sample.
In reality it would not have been a problem because the device the card is driving is low-pass filtered at about 500Hz, so the steps in the waveform will be smoothed, but I feel better having confirmed the reason for the "strange" behaviour.
Chris
10-21-2013 05:39 PM
Thanks to this whole thread; 10 microseconds was the magic value for me as well, and it just ended two days of total hassle getting weird samples at random times. Whew.