Real-Time Measurement and Control

Showing results for 
Search instead for 
Did you mean: 

NI 9219 - Reading two tasks with Python

Go to solution

Hello, I am trying to measure two channels on a NI 9219 but am having issues when I increase my sample rate. I want to take 20 samples at 100Hz for each channel at the same time. Is this possible? Below is some of my code. I am getting the following error 

nidaqmx.errors.DaqError: The specified resource is reserved. The operation could not be completed as specified.
Task Name: _unnamedTask<0>

Status Code: -50103
import time as t
import nidaqmx
import numpy as np

vCH = 'cDAQ9184-NGIALSMod3/ai1'
pCH = 'cDAQ9184-NGIALSMod3/ai0'

fSampling = 100.0  # Hz
nSamples = 20  # samples

def vcMeasure(vCH, pCH, dtMax):
    with nidaqmx.Task() as task, nidaqmx.Task() as task2:

        # Pressure
        task2.ai_channels.add_ai_bridge_chan(pCH, units=nidaqmx.constants.VoltageUnits.FROM_CUSTOM_SCALE,

        # Volume
        task.ai_channels.add_ai_bridge_chan(vCH, units=nidaqmx.constants.VoltageUnits.FROM_CUSTOM_SCALE,

        xs = []
        ys = []
        xs2 = []
        ys2 = []
        t1 = t.time()
        t2 = t.time()
        dt = t2 - t1

        while dt < dtMax:
            data2 =
            data =

            sampAV = sum(data) / len(data)
            sampAVP = sum(data2) / len(data2)
            t2 = t.time()
            dt = t2 - t1

            print('time: ', dt)

    xs = np.array(xs, dtype=np.float64)
    ys = np.array(ys, dtype=np.float64)
    xs2 = np.array(xs2, dtype=np.float64)
    ys2 = np.array(ys2, dtype=np.float64)

    return xs, ys, xs2, ys2
0 Kudos
Message 1 of 6

Hi nordec,


You can configure this to work at faster speeds than 2Hz by changing the ADC Timing Mode Property as shown in the article below (for LabVIEW). If you're in thermocouple measurement mode (High speed 20ms conversion time), then I don't expect you to be able to operate at those speeds. It'll be at the spec limit if you won't have much margin for error (high speed 10 ms conversion time).

How Can I Sample at More Than 2Hz with My NI 9212, 9213, 9214, 9=and 9219?


I found the equivalent property listed in some Python DAQmx documentation.





Message 2 of 6

Hi Ben,


When  I run only one channel I can get the rate I am looking for but when switching to two channels I am unable to get that same rate. Would the ADC timing still govern this?


Thank you

0 Kudos
Message 3 of 6

Hi nordec,


I would expect it to govern this, but maybe I'm missing something.


What rate are you able to implement a single channel at that you can't implement on multiple channels?

Have you been able to identify the maximum rate you can run at when running multiple channels?




0 Kudos
Message 4 of 6

I can implement a single channel at 100 Hz and I cannot run it at all with two channels. I am getting an error that the resource is reserved when trying to read the second channel in my loop. Do I have  to stop the first task before running another on a different channel? Or should I be able to read one task while another is being read? 

0 Kudos
Message 5 of 6
Accepted by topic author nordec
03-25-2019 03:25 AM

That's a good point. And one that I missed earlier when working on the higher speed analog inputs.

This module can only run one input task at a time (please see the links below).

How Many DAQmx Tasks Can I Run Simultaneously


This also gets addressed in our article regarding the original error message you were seeing:


Error -50103 when Using NI-DAQmx with Support for LabVIEW





Message 6 of 6