08-17-2015 08:58 AM
I am using a USB6356 to symultaneously write 3 digital signals with a task and read an analog signal using another task. It works quite well except for the first time I run the program, in this case the read signal is significantly delayed with respect to the output. I have observed the signals on a scope and they were perfectly in sync so the problem seems to be on the acquisition/processing end.
The read/write process is triggered by pressing a button, and this strage behaviour only happens once after I stop and restart the execution of the program.
I have also tried to "force sync" both tasks with a case structure but the result was exactly the same. Any ideas?
08-17-2015 10:40 AM
I don't know about the USB devices, but in other environments, I use SIGNAL ROUTING to get this done.
Here I set up the OUTPUT task, but I route the SAMPLE clock to come from the INPUT sample clock.
So the input and output are clocked at exactly the same time (within a few nSec).
I don't have to rely on trying to get two software paths to line up (which will always be problematic).
Blog for (mostly LabVIEW) programmers: Tips And Tricks
08-18-2015 12:52 AM
Hello thehun
attached a little example to better show what Steve explained
On your device the routing should work, so the clock form the AI can be used for the DO and the AI start trigger to synchronice the in- and output.
08-18-2015 06:49 AM
Thanks,
unfortunately DO runs at 1MHz rate and the AI at 84KHz so I can't use a shared clock. I have tried to use the same external trigger for both tasks but it won't work since one of the tasks throws the followinf error:
Error -50103 occurred at DAQmx Read (Analog 1D DBL 1Chan NSamp).vi:4800001
Possible reason(s):
NI Platform Services: The specified resource is reserved. The operation could not be completed as specified.
Task Name: USB6356_Acq_Trig
08-18-2015 08:57 AM - edited 08-18-2015 09:03 AM
Hello thehun,
attached a modified example in this the ai start trigger is used to start the do task.
08-18-2015 09:08 AM
Hello thehun,
a second option is a counter which generates a deviced PWM signal from the DO sample clock.