Hello,
I am converting a nidaq 6.9.3 version-based program into DAQmx 9.5.5f4 version using CVI 2012.
The program moves the light detector using a stepper motor and reads the light detector output at various points on a linear stage.
Old program worked well with some homemade hardware that were controlled by NI PCI-1200 DAQ card in Dell Precision 390.
My new hardware is NI PCIe-6321 in Win 7 HP Z210 computer. None of the other hardware is changed. To save time, I used a strategy to combine many DAQ processes in a one function called Configure(). Here is how it was written in Configure() function:
----------------------------------------------------------------
// taskHandle1 - to read Port 0 (motor data)
DAQmxErrChk (DAQmxCreateTask("",&taskHandle1));
DAQmxErrChk (DAQmxCreateDIChan(taskHandle1,"Dev1/port0", "",DAQmx_Val_ChanForAllLines));
DAQmxErrChk (DAQmxStartTask(taskHandle1));
// taskHandle2 - to read Port 1 (motor limit data)
DAQmxErrChk (DAQmxCreateTask("",&taskHandle2));
DAQmxErrChk (DAQmxCreateDIChan(taskHandle2,"Dev1/port1", "",DAQmx_Val_ChanForAllLines));
DAQmxErrChk (DAQmxStartTask(taskHandle2));
// taskHandle3 - to read/write Port 2 (for control pulses)
DAQmxErrChk (DAQmxCreateTask("",&taskHandle3));
DAQmxErrChk (DAQmxCreateDIChan(taskHandle3,"Dev1/port2", "",DAQmx_Val_ChanForAllLines));
DAQmxErrChk (DAQmxStartTask(taskHandle3));
// taskHandle4 - PC0/P2.0 Motor CW/CCW control
DAQmxErrChk (DAQmxCreateTask("",&taskHandle4));
DAQmxErrChk (DAQmxCreateDOChan(taskHandle4,"Dev1/port2/line0","",DAQmx_Val_ChanPerLine));
DAQmxErrChk (DAQmxStartTask(taskHandle4));
// taskHandle5 - PC1/P2.1 Motor CW/CCW control
DAQmxErrChk (DAQmxCreateTask("",&taskHandle5));
DAQmxErrChk (DAQmxCreateDOChan(taskHandle5,"Dev1/port2/line1","",DAQmx_Val_ChanPerLine));
DAQmxErrChk (DAQmxStartTask(taskHandle5));
// taskHandle6 - PC2/P2.2 Motor CW/CCW control
DAQmxErrChk (DAQmxCreateTask("",&taskHandle6));
DAQmxErrChk (DAQmxCreateDOChan(taskHandle6,"Dev1/port2/line2","",DAQmx_Val_ChanPerLine));
DAQmxErrChk (DAQmxStartTask(taskHandle6));
// taskHandle7 - PC3/P2.3 Motor CW/CCW control
DAQmxErrChk (DAQmxCreateTask("",&taskHandle7));
DAQmxErrChk (DAQmxCreateDOChan(taskHandle7,"Dev1/port2/line3","",DAQmx_Val_ChanPerLine));
DAQmxErrChk (DAQmxStartTask(taskHandle7));
// taskHandle8 - PC4/P2.4 Motor CW/CCW control
DAQmxErrChk (DAQmxCreateTask("",&taskHandle8));
DAQmxErrChk (DAQmxCreateDOChan(taskHandle8,"Dev1/port2/line4","",DAQmx_Val_ChanPerLine));
DAQmxErrChk (DAQmxStartTask(taskHandle8));
// taskHandle9 - PC5/P2.5: !OE Low = 0, Hi = 1
DAQmxErrChk (DAQmxCreateTask("",&taskHandle9));
DAQmxErrChk (DAQmxCreateDOChan(taskHandle9,"Dev1/port2/line5","",DAQmx_Val_ChanPerLine));
DAQmxErrChk (DAQmxStartTask(taskHandle9));
// taskHandle10 - PC6/P2.6: Clear UP/DN Counter
DAQmxErrChk (DAQmxCreateTask("",&taskHandle10));
DAQmxErrChk (DAQmxCreateDOChan(taskHandle10,"Dev1/port2/line6","",DAQmx_Val_ChanPerLine));
DAQmxErrChk (DAQmxStartTask(taskHandle10));
// taskHandle11 - PC7/P2.7
DAQmxErrChk (DAQmxCreateTask("",&taskHandle11));
DAQmxErrChk (DAQmxCreateDOChan(taskHandle11,"Dev1/port2/line7","",DAQmx_Val_ChanPerLine));
DAQmxErrChk (DAQmxStartTask(taskHandle11));
// taskHandle20 - Analog Input Ch0
DAQmxErrChk (DAQmxCreateTask("",&taskHandle20));
DAQmxErrChk (DAQmxCreateAIVoltageChan(taskHandle20,"Dev1/ai0","",DAQmx_Val_RSE,minimum,max,DAQmx_Val_Volts,NULL));
DAQmxErrChk (DAQmxCfgSampClkTiming(taskHandle20,"",rate,DAQmx_Val_Rising,DAQmx_Val_FiniteSamps,nSamples));
DAQmxErrChk (DAQmxStartTask(taskHandle20));
---------------------------------------
I have declared the taskHandle's globally as:
TaskHandle taskHandle1, taskHandle2, taskHandle3, taskHandle4, taskHandle5, taskHandle6;
TaskHandle taskHandle7; taskHandle8, taskHandle9, taskHandle10, taskHandle11, taskHandle20;
When I compiled the program, I received the error starting from taskHandle8 for each of the tasks from 8, 9, 10, 11, & 20:
here is the error I received relating to taskHandle8 (Line #349-351):
349, 54 Type error in argument 2 to `DAQmxCreateTask'; found 'pointer to int' expected 'pointer to TaskHandle'.
350, 96 Type error in argument 1 to `DAQmxCreateDOChan'; found 'int' expected 'TaskHandle'.
351, 49 Type error in argument 1 to `DAQmxStartTask'; found 'int' expected 'TaskHandle'.
I was wondering if there are any limits on creating the number of tasks at a time. It looks to me the error started showing after starting the 7th task.
If anybody has similar experiences, it would be very much appreciated if you could point out what I was doing wrong. Thanks!