Academic Company Events Community Support Solutions Products & Services Contact NI MyNI
57 ratings:
 3.49 out of 5     Rate this Document

Causes of NI-DAQmx Error -50103 "The Specified Resource is Reserved"



Primary Software:
Primary Software Version: 7.0
Primary Software Fixed Version: N/A
Secondary Software: N/A

Problem:
Why do I get the following error when I do not explicitly use the same resources? 

Error -50103 The Specified Resource is Reserved



Solution:
When NI-DAQmx recognizes a physical resource conflict, it throws this error in the following situations.

  • Running a DAQmx application after a Traditional DAQ application without first resetting the Traditional DAQ driver.
  • Continuously starting and clearing a DAQmx task (in a loop) for an extended period of time. 
  • Having counter tasks that need two counters and one of them is being used by another task on the same device.
  • Using multiple DAQ Assistant Express VIs to access channels on the same data acquisition board.
  • Using multiple SubVIs that run without any error independently, but generate an error when called from a top-level VI. 
  • Concurrently running two or more analog input or analog output tasks.
  • Failing to properly clear a task and release its resources.


Case 1:
Running a DAQmx application after a Traditional DAQ application without first resetting the Traditional DAQ driver.  Follow the steps below to reset the Traditional DAQ driver:
  1. Go to Measurement & Automation Explorer
  2. Expand Devices and Interfaces
  3. Right Click Traditional NI-DAQ (Legacy) Devices
  4. Select Reset driver for Traditional NI-DAQ
This releases the resources previously reserved for Traditional DAQ, and lets you use the DAQmx driver for your data acquisition.



Case 2:
Continuously creating, configuring, starting, and clearing a DAQmx task (in a loop) for an extended period of time.  To avoid this problem, configure and start your task once before the loop, then call the read/write function in the loop as needed and clear the task after the loop. 

For examples on how to do this, take a look at the examples for DAQmx and the NI Community page.  To find examples, launch LabVIEW and go to Help»Find Examples.  Browse by task and select Hardware Input and Output»DAQmx.

Incorrect:


Correct:


Case 3:
Using multiple counter tasks on the same device can also produce this error. For any task that requires two counters, the second counter is reserved based on the counter that is wired to create channel vi. The counters are always paired with the counter next to it, so ctr 0 is paired with ctr 1 and ctr 2 is paired with ctr 3. Refer to this KnowledgeBase article  that lists counter tasks that use more than one counter.

Case 4:
Using multiple DAQ Assistant Express VIs to access channels on the same data acquisition board can cause this error because each Express VI creates a separate task.  It is not possible to have multiple DAQmx tasks attempting to access the same physical device. Thus it is necessary to clear each task after the data acquisition has completed. The stop input of the DAQ Assistant Express VI stops the task and releases device resources when the Express VI completes execution.

For single point or finite data acquisition the default value for the stop input is true so you do not need to wire a True Boolean constant to this input. For single point input/output (I/O), wiring False to the stop input optimizes performance, but it does not release the device's resources. Error -50103 will be thrown if you are using multiple DAQ Assistant Express VIs with single point or finite data acquisition in a loop with a False constant wired into the stop input. For continuous acquisition, the default value is False. To avoid this error, be sure to pass a True to the stop input on the last iteration of your loop.

Note that it is critical to properly set the execution order of both Express VIs if they occur within the same loop. This will prevent both DAQmx tasks from running concurrently and generating an error. You can establish order of execution by wiring the Error Out terminal of one DAQ Assistant to the Error In terminal of the second DAQ Assistant. However, when performing multiple instances of the same type of measurement within the same while loop, it is not necessary to use multiple DAQ Assistants. Instead, you can simply use a single DAQ Assistant configured for multiple channels.

Case 5:
Using multiple SubVIs that run without any error independently, but generate an error when called from a top-level VI. Error -50103 is likely to occur when you have multiple NI-DAQmxVI's that call the same task again without clearing the previously opened task. If at any given time you try to open a task that already is being used, you might receive an error "resource is reserved".

To prevent this error from occurring, clear the task before you open it again in another SubVI, or just pass the DAQmx task from one SubVI to another to avoid having to open the task again.

Case 6:
Concurrently running two or more analog input or analog output tasks.  This error can also be thrown when a program explicitly calls multiple tasks performing the same type of operation at the same time. As with the other two previous cases, this produces a situation where multiple independent tasks are concurrently attempting to access the same resource. Even though the tasks might be using different channels, this is still a conflict because they require use of the same analog to digital converter and sample clock. To resolve this issue, combine all operations of the same type into the same task. For DAQmx 7.3 and later, it is possible to do this even with multiple types of analog input if you use multiple DAQmx Create Channel VIs.

Note: Case 6 is common when trying to perform multiple tasks of the same type using a cDAQ-9172 chassis.  Keep in mind that this chassis only has one timing engine.  To avoid this problem, consolidate all of your analog acquisition into a single task to make proper use of the single timing engine.  The cDAQ-9174 and 9178 chassis have three analog input timing engines and thus can support three concurrent analog input tasks if all tasks are on separate modules.

Case 7:
Failing to properly clear a task and release its resources. When a DAQmx task starts or otherwise enters the Reserved or Committed states (See NI-DAQmx Help for Task State Model), resources associated with that task such as clocks, channels, trigger lines, or buffer memory are acquired exclusively by the task. Because the task has reserved these resources, any task that tries to access these resources will encounter Error -50103.

You can resolve this by doing one of the following:
  • Wire a True to the auto cleanup input of the DAQm Create Task.vi
  • Add a DAQmx Clear Task.vi at the end of the task
  • Add a DAQmx Control Task.vi at the end of the task, and set its action to unreserve
Note: Case 7 also includes the situation when you try to run an application a second time that failed to properly clear a task after its first execution.


Related Links:
KnowledgeBase 32JEOHW0: Why Can I Not Put More Than One Type of Measurement Into My DAQmx Task Using the DAQ Assistant?
KnowledgeBase 3D28G3Z6: Virtual Channels of Different Measurement Types in One Task in the DAQ Assistant
KnowledgeBase 4OPFI8BB: How Can I Create Two Simultaneous Analog Output Waveform on Different Channels on the Same Device?
Developer Zone Example: DAQmx Acquire with Multiple Channel Input Ranges

Attachments:
 Good DAQmx setup.png




Report Date: 01/07/2009
Last Updated: 04/04/2014
Document ID: 4T6CQKBP

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit