Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

Trying to read multidevices in an array of tasks

Hi,

 

Because of getting this error: "One or more devices do not support multidevice tasks.", I am trying to use an array of tasks to be able to read multiple devices, as suggested by 

   niStat = DAQmxCreateTask (tName, pTH);

   niStat = DAQmxCreateAIVoltageChan(*pTH, chanName, "", myConfig, rLo[i], rHi[i], DAQmx_Val_Volts, NULL);

   niStat = DAQmxSetAIRngLow(*pTH, chanName, rLo[i]);

   niStat = DAQmxSetAIRngHigh(*pTH, chanName, rHi[i]);

   niStat = DAQmxCfgInputBuffer (myTasks[t], (int) sampRate);

}

for (int t = 1; t < nTasks; t++) {
    niStat = DAQmxCfgSampClkTiming(myTasks[t], "PFI1", sampRate,DAQmx_Val_Rising, DAQmx_Val_ContSamps, sampRate);
}

niStat = DAQmxExportSignal(myTasks[0], DAQmx_Val_AIConvertClock, "PFI1");

 

for(int t = 0; t < nTasks; t++) {
    niStat = DAQmxRegisterEveryNSamplesEvent(myTasks[t],DAQmx_Val_Acquired_Into_Buffer,buffSamps,0,EveryNCallback, NULL);
}

 

for(int t = 0; t < nTasks; t++) {
    niStat = DAQmxRegisterDoneEvent(myTasks[t],0,DoneCallback,NULL);
}

Thanks.

0 Kudos
Message 1 of 3
(5,392 Views)

BTW, the two devices that I would like to read in parallel are the simulated NI 9223 cards.

 

I just noticed that these cards doesn't have a PFI output/input at all! So is this the reason why I haven't been able to export signal from the first task. If it is so, how can I read the data from these two cards at the same time?

 

Thanks.

0 Kudos
Message 2 of 3
(5,388 Views)

Hi,

 

The 9223 cards do indeed not have a PFI i/o line, so trying to export the signal to that task would be likely to be causing this error in this case. The canonical method to synchronise the Analog Inputs for these modules is for them to share a common timebase off the cDAQ analog input clock, and a common start trigger so that they start acquisition at the same time.

 

There is a good example on the NI website of synchronization features in DAQmx which I have linked below for you:

 

http://www.ni.com/white-paper/4322/en/

 

 

Best Regards,

 

James Kent

 

James Kent | Applications Engineer | National Instruments UK & Ireland
w: uk.ni.com | ireland.ni.com
0 Kudos
Message 3 of 3
(5,351 Views)