I tried to write to analog output channel with an external trigger source - PFI0. The write operation times out even after I write values 0 and 1 to the digital channel- Dev1/PFI0 within the timeout period. The error message obtained is given below
Wait Until Done did not indicate that the task was done within the specified timeout.
Increase the timeout, check the program, and make sure connections for external timing and triggering are in place.
Task Name: _unnamedTask<17>
Status Code: -200560
The code that I used for the write operation is given below. The write operation succeeds when I set the source terminal of the Sample Clock as internal source of the device in the API DAQmxCfgSampClkTiming.
I find it unusual to specify PFI0 as both a trigger signal *and* a sample clock signal.
In DAQmx, a trigger is a very different thing than a sample clock. I've seen a lot of confusion on the forums over the years when posters use the terms differently than DAQmx defines them.
I would expect to see a line of code where you call a function to *start* the task after writing data and before waiting for the task to be done. (I don't know the text API, but in LabVIEW the write function includes an optional argument for "autostart". You may or may not be getting that autostart behavior, but I'd recommend you do an explicit start and make sure.)
Otherwise, I think you'd need to pulse PFI0 3 times for your task not to timeout. The first pulse will be seen as the trigger. But it very likely won't be seen as a sample clock, because the task wouldn't have been ready to receive one until after it was armed by its trigger. So the 2nd pulse would be seen as the 1st sample clock and the 3rd pulse would be the 2nd sample clock. That should end your 2-sample finite output task, and the wait function should return without timing out.