01-25-2012 11:18 AM
Lately, I've been running into an issue with the DAQmxWaitUntilTaskDone command.
I'm putting together a program that generates a square waveform (of sorts), and I find that, if I leave the program running for a day or so, I get an overflow error on the DAQmxWaitUntilTaskDone command. I've tried using different values (including -1) for the TimeToWait value, but I keep getting the same error. What might cause this?
This is my code thus far. FWIW, I'm using an NI-6259.
190 publicStatus = DAQmxCreateTask("", taskHandle) 200 taskIsRunning = True ' Add a digital output channel to the task. 210 publicStatus = DAQmxCreateDOChan(taskHandle, "Dev2/port0/line8:16", "", DAQmx_Val_ChanForAllLines) ' Configure sample clock timing for and external signal 220 publicStatus = DAQmxStartTask(publicOutputPulseTaskHandle) 230 publicStatus = DAQmxCfgSampClkTiming(taskHandle, "Ctr0InternalOutput", 1000000#, DAQmx_Val_Rising, DAQmx_Val_AcquisitionType_FiniteSamps, numSamplesToWrite) ' Write array of values 240 publicStatus = DAQmxWriteDigitalLines(taskHandle, numSamplesInArray, False, -1, DAQmx_Val_GroupByChannel, writeArray(0, 0), sampsPerChanWritten, ByVal 0&) ' Start the task running, and write to the digital lines. 250 publicStatus = DAQmxStartTask(taskHandle) ' Wait until generation is complete 260 publicStatus = DAQmxWaitUntilTaskDone(taskHandle, TimeToWait) 270 publicStatus = DAQmxClearTask(taskHandle) 280 publicStatus = DAQmxStopTask(publicOutputPulseTaskHandle)
Does it look like there's anything wrong with my code?
Solved! Go to Solution.
01-26-2012 08:52 AM
One thing I forgot to mention: this code is run multiple times (low hundreds) during normal operation of the program it's part of.
01-26-2012 10:07 AM
Just did a bit more testing: I find that I get the overflow error when I set the TimeToWait variable too low. This is raises the question: why do I get this error when I have the TimeToWait variable set to -1?
01-27-2012 08:24 AM
Hey Armando83,
Which overflow specifically do you receive? It seems to me like this could be a buffer overflow issue...
01-30-2012 08:59 AM
There are multiple kinds of overflow errors? I've just been getting Error 6.
01-31-2012 05:35 PM
Hey Armando83,
Are you able to post a screenshot of this error?
Thanks,
02-02-2012 03:29 PM
Courtney, I did a bit more investigating, and it turns out it was a networking issue that was tripping me up. The code itself was okay, and wasn't causing any problems.
Thank you, though, for your help.
02-03-2012 02:31 PM
Hey Armando83,
I'm very glad you got it up and running!