Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Synchronized AI AO for USB-4431

I am trying to do some work with simulaneous input and output from a USB-4431. I am basing my code off of the examples here:

http://www.ni.com/product-documentation/4322/en/

 

I have a BNC cable going from ao0 to ai0 on the DAQ system, and I'm outputing a sine wave at 1000 Hz and 1 V. The input channel measures the sine wave, but it seems like there is a delay of about 60 samples or so before the output starts, so the input channel shows zero volts for 0.5 ms or so. Any ideas what is causing this issue?

 

frontPanel.png

 

blockDiagram.png

0 Kudos
Message 1 of 5
(3,875 Views)

Hi tdare, 

 

Is this delay consistent? 

 

In this case, you aren't writing to the graph the data that is being written to the DAQ at that exact point in time, because you have wired the output of the signal generator, not what the DAQ is necessarily writing at that time. It is not an exact correlation of what the DAQmx write saw because there will be a slight delay for that data to be written by the DAQmx write. There will also be a slight delay because of the physical connections.

0 Kudos
Message 2 of 5
(3,839 Views)

Roxana, thanks for your response. Yes, the delay is consistent if I run it multiple times. If I take out the "Start Digital Edge" block, then the delay shifts by a few ms each time the VI is run. I understand that there will be a very slight delay with the physical connections, but I would think this would be on the order of microseconds.

 

Interestingly, if I change the blocksize and sample rate, the delay changes. For example, I cut everything by a factor of 10, (10240 Hz and 102 data points), and the delay changes from 0.5 ms (60 data points) to 0.9 ms (90 data points). It always seems to be consistent if I run it multiple times.

 

I understand your point about the delay for data to be written to DAQmx write. It seems like there should be a way for me to wait for DAQmx Write to finish writing samples to the task before it starts. I've tried using the Wait Until Done and the Is Task Done VI's, but nothing seems to affect this delay. I was under the impression that using DAQmx Write before DAQmx Start would make sure that all of the samples are in the buffer before the task starts so that it can start generating them immediately.

 

Any other suggestions?

 

Thanks,

Tyler

0 Kudos
Message 3 of 5
(3,831 Views)

What this boils down to is that timing considerations for your DSA device are quite different than a standard DAQ device.  Syncing AI and AO is much less trivial due to the different filter delays for the AI input path vs. the AO output path.  Available sample rates are determined differently too. 

 

I'd venture that your code would give you expected results on a standard DAQ device.  I'm afraid I don't know detailed instructions offhand for getting similar sync on your DSA device, you'll have to do some more research and testing.

 

 

-Kevin P

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 4 of 5
(3,808 Views)

Hi Tyler,

 

Kevin is correct. I would consider looking at the following article for DSA Synchronization:

 

http://www.ni.com/product-documentation/12350/en/

0 Kudos
Message 5 of 5
(3,790 Views)