06-03-2024 05:59 AM
Good morning ,
I do data acquisition in my interface I can choose between finished or continuous acquisition mode, I want to add a functionality to stop the acquisition even in finished mode. zst there is a way to force the task to stop?
Solved! Go to Solution.
06-03-2024 07:01 AM
Sure, but the way you set up your code is not the way to do it.
Problems:
1. You call DAQmx Read without wiring the input to specify the # samples to read. In Finite acquisition mode, this defaults to meaning, "wait for *all* configured samples to be acquired, then return them". By the time you get out of the DAQmx Read call, your finite task will already be done!
2. Dataflow. You want to conditionally stop the task depending on the state of a GUI boolean. However, by the rules of dataflow, the value of that boolean is likely being read immediately when you start the vi, even before the task is fully configured and started. Anything you do to that GUI boolean after that time will *not* affect the value wired into the case structure.
If you simply want to abandon the task and don't care about partial data, don't call DAQmx Read until *after* you're done deciding to let the task run to completion.
If you want partial data up until the point you stop the task, you can query the task with a DAQmx Read property node for "Available Samples", call DAQmx Read while requesting that same #, and *THEN* stop the task.
-Kevin P
06-04-2024 02:18 AM
Hi ,
Thank you