07-27-2020 06:51 AM
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.
What could be the issue with the following code?
double dValues[2]{ 2, 2 };
int32 nError = DAQmxCreateTask("", &oTask);
nError = DAQmxCreateAOVoltageChan(oTask, "Dev1/AO1", "", -3.25, 3.25, DAQmx_Val_Volts, nullptr);
nError = DAQmxCfgSampClkTiming(oTask, "PFI0", 50.0, DAQmx_Val_Rising, DAQmx_Val_FiniteSamps, 2);
nError = DAQmxCfgDigEdgeStartTrig(oTask, "PFI0", DAQmx_Val_Rising);
nError = DAQmxWriteAnalogF64(oTask, 2, 1, 60, DAQmx_Val_GroupByChannel, dValues, nullptr, nullptr);
nError = DAQmxWaitUntilTaskDone(oTask, 60);
07-29-2020 07:49 PM
What is the clock source that is connected to PFI0? (please check if the signal levels at PFI0 are as per the datasheet)
You've configured the Sample Clock to come from PFI0 and the same terminal is used as a Start Trigger. Since it works with InternalSource as clock source, then the signal at the PFI0 failed to provide the necessary clocking but may have provided only the trigger edge for it to start.