From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

LabWindows multiple Tasks data acquisiton problems

Solved!
Go to solution

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);

 

0 Kudos
Message 1 of 2
(2,063 Views)
Solution
Accepted by VA.KI

Hello HenBan,

Please have a look to this forum.

Let me know if it solves your problem (link is below).

 

https://forums.ni.com/t5/LabWindows-CVI/Is-there-an-equivalent-to-producer-consumer-design-patterns-...

__________________________________________
The best way to thank, is to give KUDOS
0 Kudos
Message 2 of 2
(1,782 Views)