Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Align Analog In with analog Out in High sampling rate

Hi, not sure if I missed something apparent.  I use NI-6221 to output a step analog function (50 points in low voltage followed by 50 points high voltage),   connecting it to my device's input and use analog In to sample my device's output.   The Analog In is configured to sync with the AnalogOut.   What I found is that in low sampling rate, the signal in analog In is fine.   In higher sampling rate, it starts to display a phase shift: the first few points corresponding to high voltage points then followed by the 50 low voltage points.    The higher sampling rate, the larger phase shift.   This is easy to understand from signal propagation property.   But is there any easy way we can configure NI to automatically align the analog In to analog Out so that no matter in what sampling rate, I can always be sure the first 50 analog In corresponds to low Voltage output.   I can write a software to analysis the analog In signal to find the phase shift but this causes the performance issues.
I am using DAQ c api to write the code.  

The essentail function calls for sync the two channels is via

DAQmxCfgSampClkTiming(taskHandle,cName, mRate,DAQmx_Val_Rising,DAQmx_Val_ContSamps,sz);

where cName = "ao/SampleClock"

Jeff
0 Kudos
Message 1 of 2
(2,877 Views)

Hi Jeff,

 

Are you using examples that shipped with your software? If not, I suggest using the examples that we’ve made and provide to you for free as a starting point. It seems you’re using CVI and there are examples that do AI and AO and all you would have to do is put them together into one application. You can find example programs here.

I tried to duplicate your phase delay, but was unable to do so. There is a finite slew rate for the output sample to reach the specified level, but for your device it is 15V/us, so unless you’re sampling at rates your card is not capable of, your input should not be off by more than 1 sample due to slewing. I guess there’s a caveat that if you’re using a really long cable, you could end up being delayed by more than one sample.

 

I think a better approach at this point is for you to explain a little more about your application and also share in more detail what you’ve done to tackle the issue you’re seeing. This will help the community understand how best to go about what you’re doing.

In addition to our Developer Zone, you can find more resources at NI Developer Zone Community, found by visiting ni.com/community or ni.com/devzone and clicking the link in the upper-right.

Mark E.
Precision DC Product Support Engineer
National Instruments

0 Kudos
Message 2 of 2
(2,856 Views)