05-09-2008 10:28 AM
05-09-2008 11:12 AM
05-15-2008 10:36 AM
05-15-2008 02:01 PM
return 1;
if (errorNumber = (int)DAQmxCreateAIVoltageChan(gTaskHandle, toChar(QString(this->getDeviceName() + "/" + channel)),"",DAQmx_Val_PseudoDiff,
(float64)minVolts,(float64)maxVolts,DAQmx_Val_Volts,NULL) != 0)
return 1;if (errorNumber = (int)DAQmxCfgSampClkTiming(gTaskHandle,"OnboardClock",(float64)sampFreq,
DAQmx_Val_Rising, DAQmx_Val_ContSamps,(uInt32)this->getDataBufferSize()) != 0)
return 1;if (errorNumber = (int) DAQmxRegisterEveryNSamplesEvent(gTaskHandle,DAQmx_Val_Acquired_Into_Buffer,
(uInt32)this->getDataBufferSize(), 0, (DAQmxEveryNSamplesEventCallbackPtr )DAQCallback, this) != 0)
return 1;(float64*)parent->data, (uInt32)parent->getDataBufferSize()*parent->getNumberOfChannels(), &numRead, NULL) != 0)
return 1;
Thats it with lots of error checking stripped out, but I dont think you are going to get much from that. I think what I will have to do is go back to a smaller program and see if I can recreate the bug. I just thought someone may have had a similar problem, or know what was wrong from the symptoms.
Cheers,
Phil Winder
05-15-2008 03:04 PM
05-16-2008 04:53 AM
05-16-2008 06:12 AM
if (errorNumber = (int)DAQmxCfgSampClkTiming(gTaskHandle,"OnboardClock",(float64)sampFreq,
DAQmx_Val_Rising, DAQmx_Val_ContSamps,(uInt32)this->getDataBufferSize()) != 0)
{
getError(errorNumber);
return 1;
}
Where getError is:
{
if (error == 0) return "";
else
{
char errorString[charBufferSize];
DAQmxGetErrorString ((int32)error, errorString, charBufferSize);
QString errMsg = toQString(errorString,charBufferSize);
QMessageBox::warning(0, tr("DAQ Error"),
QString::number(error) + ": " + errMsg,
QMessageBox::Ok,QMessageBox::Ok);
return errMsg;
}
}
This works, since I have had error messages before. Just most of the time, as with the buffer overrun case, the error number is 1 and returns "" as the error message.
05-16-2008 11:43 AM
if((errorNumber = (int)DAQmxCfgSampClkTiming(...)) != 0)
{
...
}
Hope this solves your problem,
Brad
05-16-2008 03:35 PM
05-18-2008 03:56 AM