Error -200288 When Starting and Stopping a Task in DAQmx

Updated May 12, 2023

Reported In

Hardware

  • NI-9401
  • cDAQ-9174

Driver

  • NI-DAQmx

Issue Details

I am stating a task in LabVIEW, then stopping the task, changing the timing and starting the task again. When I do this I am getting error -200288: 

Measurements: Attempted to write a sample beyond the final sample generated. The generation has stopped, therefore the sample specified by the combination of position and offset will never be available.

Specify a position and offset which selects a sample up to, but not beyond, the final sample generated. The final sample generated can be determined by querying the total samples generated after a generation has stopped
.

How can I prevent this from happening? 

Solution

Instead of stopping the task changing the timing and then restarting the task, change the sample rate of the clock by using a DAQmx Timing Property node with the property set to SampClk.Rate. This will allow you to change the sample rate of the task without stopping and restarting the task. 


Another option is to use the Decimate VI to change the sample rate of the task by eliminating some of the samples.