Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Timing synchronize options between PXI E series and X series module

Solved!
Go to solution

A sample offset of 1 suggests that you've already done some kind of compensation for the DSA devices' filter delay.  An earlier partial screenshot shows a property node where you seem to be using a DAQmx feature to do that.

 

I understand that the 1 sample offset is acceptable, but figured it'd be worth giving you some understanding why it isn't 0.   Maybe *next* time, you'll *need* it to be 0.   I'm assuming that the DAQmx filter delay compensation works exactly as it nominally should so here's my speculation about the remaining 1 sample offset.

 

It's actually a very commonplace consideration when syncing AI and AO and it gets down into the sub-microsecond realm of details.  The sample clock active edge for AO causes the AO device's circuitry to initiate a D/A conversion.  But it takes a very small finite time for that to happen, maybe a small number of nanosec for the digital logic plus probably another small fraction of a microsecond for the analog (as specified in the AO device's slewing rate spec).

 

It's all *very* small, but the point is that the very first AO sample is not generated until a tiny fraction of a second *after* the very first AI sample has been captured.  It'll be the 2nd AI sample that shows how the system responded to the 1st AO sample.  In the case of a simple loopback like you're doing to test, that explains the 1 sample offset.

 

A strategy I typically advocate isn't available to you.  I like to generate the clock with a counter pulse train, generate AO on the leading edge of the pulses, and sample AI on the trailing edge.  But in your case, you have no way to get a sample clock edge for AO prior to when it has already been used to perform AI.  You are stuck with the 1 sample offset.

 

So the other simple (but now *justified*) strategy to re-align AI and AO is to throw away the very first AI sample.  Just keep in mind that when you do things like this, you first need to have a solid justification for it.  Don't get in the habit of tossing out samples just because it seems convenient.

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy coming to an end (finally!). Permanent license pricing remains WIP. Tread carefully.
0 Kudos
Message 31 of 33
(1,432 Views)

Maybe something to try based off Kevin's post. What if we tell the AI channel to sample on falling edge and leave AO using rising edge? This is one of the terminals on the DAQmx Configure Sample Clock .vi's. 

0 Kudos
Message 32 of 33
(1,415 Views)

I have tried to set the AI as falling edge and AO as rising edge, but nothing changed (it is still 1 sample difference).

But regardless, I think I shall maintain the current code for now as it is well within my application needs.

 

0 Kudos
Message 33 of 33
(1,338 Views)