Additional Information
When using the DAQmx Python API, you may encounter a similar issue. Below is a small code snippet that demonstrates the problem. When the commented line is executed, an error message will appear due to the
auto_start parameter being set to
True.
DataStream = nidaqmx.stream_writers.AnalogSingleChannelWriter(task.out_stream, auto_start=True)
DataStream.write_many_sample(Data)
# task.start()
Understanding the source of this error involves understanding the NI-DAQmx Task State Model. NI-DAQmx uses the Task State Model to improve ease of use and speed up driver performance. The Task State Model consists of five states:
Unverified,
Verified,
Reserved,
Committed, and
Running. For more information about the Task State Model refer to the Related Links.
When a task begins to perform an operation, the task transitions to the
Running state. You can explicitly perform this transition by invoking the
DAQmx Start Task.vi
, however, starting a task does not necessarily begin acquiring samples or generating data. It is important to note that if a
DAQmx Read.vi
or
DAQmx Write.vi
is called, it will automatically start the task and transition the task into the
Running state. If the
DAQmx Start Task.vi
is called after either one of these functions, it will be trying to start a task that is already in the
Running state. In order to avoid this error, ensure that the
DAQmx Start Task.vi
is not called after your task has begun acquiring or generating data.