This content is not available in your preferred language.

The content is shown in another available language. Your browser may include features that can help translate the text.

Error -50103 When Using NI-DAQmx With LabVIEW or in NI-MAX

Updated Aug 30, 2019

Reported In

Software

  • LabVIEW

Driver

  • NI-DAQmx

Issue Details

Why do I get the following error? 

Error -50103 occurred at DAQmx Start Task.vi: 7220001

Possible Reason(s): The specified resource is reserved. The operation could not be completed as specified. 
 

Solution

This error is the result of NI-DAQmx recognizing a physical resource conflict. Some common resources include timing engines, channels, trigger lines, tasks, sample clocks, etc. Because the error can be observed in a variety of situations, we describe several possible cases below:
 
  • Case 1: Failing to properly clear a task and release its resources.
  • Case 2: Using a counter that is already reserved from a multi-counter counter tasks.
  • Case 3: Using multiple tasks to access the same physical channels on a data acquisition board.
  • Case 4: Using multiple SubVIs that run without any error independently, but generate an error when called from a top-level VI.
  • Case 5: Concurrently running more analog input or analog output tasks than the DAQ device allows.
  • Case 6: Outputting analog output waveforms using multiple hardware-timed tasks that do not share a sample clock.
  • Case 7: Attempting to use a task in NI-MAX while it is being used by a running LabVIEW program.
  • Case 8: Using the wrong source for a counter task

Case 1: Failing to properly clear a task and release its resources.

When a DAQmx task starts or otherwise enters the Reserved or Committed states resources associated with that task such as clocks, channels, trigger lines, or buffer memory are acquired exclusively by the task. 

You can resolve this by doing one of the following:
  • 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

Don't abort the execution using the abort button if you are using a while loop to read or write and the Clear task is executed after the loop. Use the Stop Button attached to the conditional terminal of the Loop instead.

Case 2: Using a counter that is already reserved from a multi-counter counter tasks.

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. Some counter tasks require multiple counters

The problem occurs because the number of actual counters used differs depending on the counter task type. Especially in situations like the attached code below. See the snippet below.

For the M Series DAQ based on the STC II chip, two counters are used to generate the finite pulse train. Refer to the table below for a comparison of the counters of the DAQ devices by series.
As you can see in the table, in the case of the errors covered in this article, the M Series DAQ device has two counters, and the resource error occurs because the finite pulse task requires two counters.
 
Counter FunctionE SeriesM SeriesX Series
Counter / Timers2, 24-bit2, 32-bit4, 32-bit
Counter Timebase20 MHz80 MHz100 MHz
Quadrature Encoder InputsNoYesYes
Digital Debouncing FiltersNoneUsable with
Counte Tasks Only
 
Available on All
Digital  Lines
Max Rate Benchmark for
Buffered Counter Input Tasks
150 kHz on
a single Counter (PCI)
380 kHz (PCI) 
1194 kHz - 621x single counter
10 MHz on all
four  counters (PCIe)
Buffered Counter Outputs?NoNoYes

 
Case 3: Using multiple tasks to access the same physical channels on a data acquisition board.

Each physical channel can only be assigned to one task. You may not realize that this is occurring, so make sure to check any tasks created in NI MAX, and that there are no other tasks/subVI's running which include the same resource.  

Case 4: 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-DAQmx VI's that call the same task again without clearing the previously opened task. To prevent this error from occurring:
  • Option 1: 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.
  • Option 2: If you're doing the same operation on multiple channels, use channel expansion to Select More Than One NI-DAQmx Channel in MAX .

Case 5: Concurrently running more analog input or analog output tasks than the DAQ device allows.
 

Each type of hardware (PCI/PCIe and cDAQ) has a limited number of concurrent hardware sessions available.  This limits the number of concurrent tasks an application can call simultaneously.

  • Combine common type operations into a single task. DAQmx 7.3 and later supports multiple analog input types via Create Channel VI's.

When using E, M, S, X, or AO Series DAQ devices, you can do one hardware-timed analog output task. However, most devices also support performing one or more software-timed tasks simultaneously with one hardware-timed task. This functionality allows the device to generate different signals with different timing characteristics at the same time on the same device.

  • If you do have multiple channels on one output task, these channels will share the same timing information because the will share the AO sample clock. However, different signals can be output on each channel. Here is an example of this.
Case 6: Outputting analog output waveforms using multiple hardware-timed tasks that do not share a sample clock.

You should be able to achieve this behavior by implementing an example in LabVIEW. Navigate to LabVIEW examples by selecting Help>>Find Examples... In the example finder select the Browse tab then Hardware Input and Output>>DAQmx>>Analog Output>>Voltage - Continuous Output vi. This will allow you to select any number of channels on the front panel and output the same waveform to those channels. 

To implement a phase shift on those channels you can edit the existing example in a similar way to the screen shot below. 

 


Save and close the Waveform Buffer Generation (multi) VI. On the front panel of the Cont Gen Voltage Wfm-Int Clk VI, choose the two channels to output the simultaneous waveforms. For example, to output the waveforms on channels 0 and 1 of device 1, the physical channels should be Dev1/ao0:1. See the following article about how to select multiple channels in LabVIEW: Select More Than One NI-DAQmx Channel in LabVIEW. When the program runs, the waveform should be similar to the following image (for a phase shift of 180°).

Other workarounds include:

Multiple Software-Timed Tasks Simultaneous With One Hardware-Timed Task

When using E, M, S, X, or AO Series DAQ devices, you can do one hardware-timed analog output task. However, most devices also support performing one or more software-timed tasks simultaneously with one hardware-timed task. This functionality allows the device to generate different signals with different timing characteristics at the same time on the same device.


Multiple AO Channels on One Hardware-Timed Task

Inside of a hardware-timed task you can include multiple AO channels. These channels will share the same timing information because they will share the AO sample clock. However, different signals can be output on each channel. Here is an example of this.

Note: On devices like the NI PXIe-4461/3 there are dedicated timing engines for both analog outputs, so it is possible to run two independently timed analog output tasks off each channel. 

Case 7: Attempting to use a task in NI-MAX while it is being used by a running LabVIEW program.
 
If a LabVIEW program is currently running your DAQmx task to acquire data, then it will reserve the hardware resource corresponding to this task. This means that NI-MAX will be unable to concurrently access this hardware resource, or device.

To prevent this conflict, you can either perform any NI-MAX actions before or after running your LabVIEW program, or while your program is stalling in a state before DAQmx Start Task has been called or after DAQmx Clear Task has been called. These functions reserve and release hardware resources, respectively.

Case 8: Using the wrong source for a counter task

Make sure that the source you are selecting is supported for the task you are trying to run. (for example, wiring in an internal counter for a digital edge instead of the onboard clock).

Additional Information

Traditional NI-DAQ Case: Running a DAQmx application after a Traditional NI-DAQ (Legacy) application without first resetting the Traditional NI-DAQ (Legacy) driver. Follow the steps below to reset the Traditional NI-DAQ (Legacy) 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 (Legacy)
This releases the resources previously reserved for Traditional NI-DAQ (Legacy), and lets you use the DAQmx driver for your data acquisition.

Also of Note:
NI 672X devices do not support performing a hardware-timed task simultaneously with one or more software-timed tasks.

 

 

WAS THIS ARTICLE HELPFUL?

Not Helpful