I am implementing data aquisition in CodeWarrior project using NIDAQmxBase framework.
(USB-6009 board, OSX 10.4.6, Metrower CodeWarrior 10.0, Mach-0, PowerPlant ).
Basically it works, however I run into several problems.
For some of them I found workarounds, but one is still unresolved.
Problem description:
First or/and second call of DAQmxBaseStartTask() function returns error
error# 0xBFFF000E
"Refnum to Session in Fusion.WriteThenRead.vi->Fusion.AIADC.getResolution.vi->USB-92xx
AI Start Get Info.vi->DAQmxBase Start Task 92xx.vi:2->DAQmxBase Start Task.vi:1->DAQmxBaseStartTask.vi->DAQmxBase"
In my application I have runDigitizer() function called in application main loop by user command.
OSStatus runDigitizer(...) // configuration parameters are omitted
{
OSStatus error = 0;
static TaskHandle gTaskHandle = NULL;
if (gTaskHandle) error = DAQmxBaseClearTask (gTaskHandle);
if (error==0) error = DAQmxBaseCreateTask ("", &gTaskHandle);
if (error==0) error = DAQmxBaseCreateAIVoltageChan (gTaskHandle,chanList,"",DAQmx_Val_Cfg_Default,min,max,DAQmx_Val_Volts,NULL);
if (error==0) error = DAQmxBaseCfgSampClkTiming (gTaskHandle,"OnboardClock",mSamplingRate,DAQmx_Val_Rising,DAQmx_Val_ContSamps,mBlockSamples);
if (error==0) error = DAQmxBaseCfgInputBuffer (gTaskHandle,200000);
if (error==0) error = DAQmxBaseStartTask(gTaskHandle);
return error;
}
1) If runDigitizer() is called later in program (in application main loop), first call of runDigitizer() works fine, second call always results in above mention error, subsequent call are fine again.
Application Quit command is not working anymore.
2) If I call DAQmxBaseCreateTask() in main() function before application main loop, the behavior is different.
First and sometimes a second call of runDigitizer() fail with 0xBFFF000E error, then everything runs as expected.
Application Quit command is working fine in this case.
Any suggestions?