01-25-2022 03:10 AM
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.
01-25-2022 03:36 AM
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…
01-25-2022 04:57 AM
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.
01-25-2022 06:07 AM - edited 01-25-2022 06:09 AM
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…