LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQmx write/read clear or stop task?

In a application I use Daqmx Global Channel connected to a DAQmx Read (binary, 1 Line, 1 Point). This reading is made now and then depending on external signals. Is it always necessary to Stop that task with DAQmx Stop after each use?

What happens if I don't stop it? 

 

The application have more DAQmx in other places in the code reading/writing other channels.

 

 

 

0 Kudos
Message 1 of 4
(1,635 Views)

Hi Nap,

 


@TakeANap wrote:

In a application I use Daqmx Global Channel connected to a DAQmx Read (binary, 1 Line, 1 Point). This reading is made now and then depending on external signals. Is it always necessary to Stop that task with DAQmx Stop after each use?

What happens if I don't stop it?


Behaviour depends on your task definition!

 

I guess that task is configured to "samples on demand" (without any Timing settings), so there should nothing happen without the DAQmxStop. You should not forget to cleanup all tasks before stopping the main VI…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 4
(1,625 Views)

Correct. Sample on demand. After the DAQmx Read/write I have nothing. I have some few "clusters" with DAQmx Read/write in the code. Some of them are used continuously.  Some of them are used one time each test cycle (product testing). None of them have Stop Task or Clear Task. This is bad programming I think. However, it working good.
Why I ask is because sometimes (1 of 500) the analogue Read returns NaN. Does not feel good. I thinking of resetting the device (USB-DAQ) before each product test cycle. Feels not so good. Therefor I thinking of Stop each task after use.

 

0 Kudos
Message 3 of 4
(1,613 Views)

Hi Nap,

 


@TakeANap wrote:

None of them have Stop Task or Clear Task. This is bad programming I think.


Yes, that's bad.

Cleanup all references (not just DAQmx!) before exiting your program…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 4
(1,600 Views)