03-24-2017 10:36 AM
Hi,
While working with NI counter input channels in the past, we have been advised to add channels to their own tasks. 2 counter input edge count channels thus require 2 tasks. However, while working with an NI 9361 module (on a cDAQ-9188 chassis), I notice the following error:
DAQmx Error: The specified resource is reserved. The operation could not be completed as specified.
Task Name: _unnamedTask<1>
Status Code: -50103
I have attached my C code to reproduce the issue. Is this different from other devices? Should I be using a different approach in this case. Please let me know your thoughts.
Best,
Varun Hariharan.
MathWorks
03-27-2017 05:51 PM
Hello vharihar,
Yes you are correct. If you have 2 counter input channels you will need to have two separate tasks. This is the case for all devices using DAQmx functions. This error means that one of your counter input resources in being used by something else. A few possible reasons could be the following:
- Do you have a test panel open?
- Do you use the resource in another location without properly closing it?
- Is there other code that is running using the channel?
Here is an article that describes the error in a little more detail.
Causes of NI-DAQmx Error -50103: "The Specified Resource is Reserved
http://digital.ni.com/public.nsf/allkb/485201B647950BF886257537006CEB89
Danielle
National Instruments
03-31-2017 04:03 PM
Hi Danielle,
Thanks for your reply. I do not have the resource reserved anywhere else. I went through the list of possible scenarios here and I do not think they apply. I run this code as soon as I start my computer. No other application is using this task. Since this is a edge counter operation, only 1 counter is used. Also, I notice this also if I update my code to use different counters (for example, ctr0 and ctr3).
Note that I observe this behavior on NI 9361 and not any other modules that support counter input operations.
Please let me know your thoughts.
Thanks,
Varun Hariharan
MathWorks
04-07-2017 01:52 PM
Varun,
Please take a look at the article below. If you look at the counter input task on both the hardware and software timed tables, you can see that this device only supports a single task. If you need to use multiple counters you need to add all the required counters to the same task.
How Many Different Tasks Can Concurrently Run on a CompactDAQ Chassis Gen II?
http://digital.ni.com/public.nsf/allkb/5E0B829E50ADE1BC86257AC50062B2D2
Danielle
National Instruments