Quantcast
Channel: LabWindows/CVI topics
Viewing all articles
Browse latest Browse all 5340

LabWindows multiple Tasks data acquisiton problems

$
0
0

Hi all,

 

I'm new to LabWindows and have some problems with my data acquisition while running multiple tasks in the same loop.

I am using the cDAQ-9189 with the 2019 version of LabWindows. The following modules are used to read the data from different sensors:

 

NI 9218: Force at channel 0, Torque at channel 1.

NI 9203: Measuring current.

NI 9401: digital angular measurement.

 

The sample rate I chose is 1 kHz. In my code, there's a for loop with 5000 steps. In each step I read one sample from each of the modules. As long as only one of the tasks operates in the loop, everything is fine and no problems occur. The problem is:When there are two tasks running at the same time, the data acquisition is slowed down and not plotted correctly afterwards. When I run all the tasks in the loop, I get the error: Error -200279: Unable to Keep Up with Acquisition in DAQmx.

That's an error you could solve with the 'Producer & Consumer' architecture in LabView ... but is there anything similar to that in LabWindows? Multithreading maybe?

Do you have any hints or tips so that my data acquisition works correctly, with all the tasks in parallel? Any help would be appreciated. Thanks in advance!

 

See my code for the data acquisition below:


CreateDAQTaskInProject(&daqTaskCurrent);
CreateDAQTaskInProject2(&daqTaskAngle);
CreateDAQTaskInProject1(&daqTaskForce_Torque);

 

for(i=0; i<5000; i++){

       DAQmxReadAnalogScalarF64 (daqTaskCurrent, 10, &dataAmps[i] ,0);
 

       DAQmxReadAnalogF64 (daqTaskForce_Torque, 1, 10.0, DAQmx_Val_GroupByChannel, &dataForceTorque, 2,
       &sampsPerChanRead, 0);
       dataForce[i]=dataForceTorque[0];
       dataTorque[i]=dataForceTorque[1];

       DAQmxReadCounterScalarF64 (daqTaskAngle, 10, &dataAngle[i], 0);

}

DAQmxStopTask(daqTaskCurrent);
DAQmxStopTask(daqTaskAngle);
DAQmxStopTask(daqTaskForce_Torque);

 


Viewing all articles
Browse latest Browse all 5340

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>