11-30-2016 09:13 AM - last edited on 11-27-2024 05:13 PM by Content Cleaner
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:
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?
12-01-2016 05:40 PM
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.
12-02-2016 07:29 AM
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
12-02-2016 04:47 PM
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
12-05-2016 09:36 AM - last edited on 11-27-2024 05:13 PM by Content Cleaner
Hi Tyler,
Kevin is correct. I would consider looking at the following article for DSA Synchronization: