Discussion:
Problem with 'DAQmxWriteDigitalU16'
(too old to reply)
Hans Wurst
2006-12-19 15:10:15 UTC
Permalink
Hello there,
 
I have a problem with the following routine, because after the successful execution of the 'DAQmxWriteDigitalU16' function, the programm doesn't go on with the next line 'DAQmxStartTask'.
I do not get back any error message.
 

DAQmxCreateDOChan(taskHandleWrite, "Dev1/port2", "", DAQmx_Val_ChanForAllLines);
 
DAQmxSetDODataXferMech(taskHandleWrite, "Dev1/port2", DAQmx_Val_DMA);
 
DAQmxCfgSampClkTiming (taskHandleWrite, "OnboardClock", clockRate, DAQmx_Val_Rising, DAQmx_Val_FiniteSamps, numSampsPerChanWrite);
 
DAQmxCfgOutputBuffer(taskHandleWrite, numSampsPerChanWrite);
 
DAQmxWriteDigitalU16(taskHandleWrite, numSampsPerChanWrite, true, 10.0, DAQmx_Val_GroupByScanNumber, writeArray, sampsPerChanWritten, reserved);
 
DAQmxStartTask(taskHandleWrite);
 
DAQmxStopTask(taskHandleWrite);
 
Does anybody know, what's wrong?
Thanks in advance for your help!
 
Tobias
Andre_Saller
2006-12-21 13:40:10 UTC
Permalink
As the third parameter of your function DAQmxWriteDigitalU16 is set to "true" (PrameterName: Auto Start?) the task starts automatically with this function, so you donĀ“t have to call StartTask after that function.
 
Either switch the trid parameter to false, or remove the StartTask function. As the Datageneration is finite, you do not nedd to call StopTask either, because the task will stop automatically, when all data is generated. What you should do is, call ClearTask at the end of your application, so that all resources are cleared.
Loading...