10-09-2006 12:13 PM
10-09-2006 05:02 PM
John,
The general rule is that you can only have one analog input task at a time. Because of the way you have coded your application and the way the DAQmx driver works, you never end up having more than one task active at a time. At the heart of a DAQmx task is a state machine which defines the software and hardware state. A task moves from created to verified to reserved to committed to running as you read your task. However, if you never explicitly change the state of a DAQmx task (ie.. calling DAQmx Control Task or DAQmx Start Task), it will implicitly revert to the state it was in before it began running. In your case, since you never explicitly reserve, commit, or start your tasks, they will transition back to a state in which no hardware is reserved after you call read. This allows the other tasks you use to do the same thing. The downside of this, is for every time you call read, the driver must re-program the hardware (the analog input subsystem of these devices is coupled in more ways than just in the clocks... ie all channels share the same ADC, data FIFO, etc). As such each call to DAQmx Read will take longer than if you combined all of your channels into a single task, explicitly called DAQmx Start Task, then performed your reads).
To answer your question, the behavior you are seeing is a result of DAQmx's state model. Assuming that you are using an MIO (E-Series or M-Series) device, there are more limitations than just the use of a clock or not. To test this, take one of your tasks, and call DAQmx Start Task on it before attempting to read one of your other tasks. I would expect that in this case you would receive a resource reservation error.
Hope this clears things up for you,
Dan
10-09-2006 05:12 PM