Having an issue writing a voltage value to a PXI-6229 DAQ. The problem is that the wait for the write task to complete never gets done. I originally had a time=-1 parameter, and the program would hang on the DAQmxWaitUntilTaskDone statement. Changed to 0.1 seconds to let the program move on, although with an error.
This works (does not hang on the infinite wait) when using the DAQmx simulator, but fails on the real hardware.
Here's the routine that writes the value (with the task started by another subroutine prior to this call):
void DAQVoltageOut(TaskHandle taskIn, float64 AnalogValue)
{
int32 DAQmxError = DAQmxSuccess;
float64 data[1] = {0}; // need pointer to float64 for DAQmx call below
data[0] = AnalogValue; // Put voltage value in array element
// Write the single value to the channel opened in CreateDAQVoltageOut.
DAQmxWriteAnalogF64(taskIn, 1, TRUE, 10.0, // TRUE sets autostart
DAQmx_Val_GroupByChannel, data, NULL, 0);
// Start the task. Wait until the task is done. Stop the task.
DAQmxStartTask(taskIn);
// FIXME -- the following fails to complete. If infinite time, still does not complete
DAQmxWaitUntilTaskDone (taskIn, 0.1); // Wait 0.1 second
DAQmxStopTask(taskIn);
}