The problem is caused by not disconnecting the physical hardware connection between program executions. The DAQmx Channel Property Node used to route a timing signal is called
Counter Output » Pulse » Output Terminal. This property allows you to specify which terminal will output the generated signal. Task-based routes are created using either a channel property node or the
DAQmx Export Signal VI . With task-based routes, the route is reserved during the execution of the program and is unreserved when the task is cleared using
DAQmx Clear Task VI . However, the physical hardware connection remains unchanged.
In order to clear the route completely, you can either reset the device or call the
DAQmx Tristate Output Terminal VI . The Tristate VI is found on the Functions palette at
Functions » Measurement I/O » NI-DAQmx » Advanced » Signal Routing » DAQmx Tristate Output Terminal. The terminal that is connected to input of the Tristate VI must not currently be in use in an active route, meaning that DAQmx Clear Task VI must have already been called. Correct use of this VI will cause the specified terminal to be placed in a Hi-Z state, and will prevent driving terminals with multiple signals which could result in hardware damage.
DAQmx Connect Terminals VI similarly creates an explicit route as specified by the inputs, and you must call
DAQmx Disconnect Terminals VI to clear the route. DAQmx Disconnect Terminals can not be used to clear task-based routes that are created using DAQmx Channel Property Nodes.
The code snippet below shows how to properly use the DAQmx Tristate Output Terminal VI and to guarantee that physical hardware routes are disconnected after each run.