Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Measuring 4 counter inputs through NI 9401

Hi

 

I am counting 4 counter inputs using NI 9401.when i run them individually they run fine.But when I run them  together I get Error -201133 9(details given below) .I searched in NI forum and found this normally occurs when someone is trying to use NI 9401 both as input and output but I am using it as only input why I am having this issue.Please advise

 

 

 

Error -201133 occurred at DAQmx Start Task.vi:2

 

Possible reason(s):

Device cannot be configured for input or output because lines and/or terminals on this device are in use by another task or route. This operation requires temporarily reserving all lines and terminals for communication, which interferes with the other task or route.

If possible, use DAQmx Control Task to reserve all tasks that use this device before committing any tasks that use this device. Otherwise, uncommit or unreserve the other task or disconnect the other route before attempting to configure the device for input or output.

Device: cDAQ1Mod2
Digital Port: 0
Lines: 4

Task Name: _unnamedTask<5A>

 

 

0 Kudos
Message 1 of 12
(9,301 Views)

Hi vnarang,

 

Running four counter input tasks on the NI 9401 should work, assuming that the module isn't already configured for output. It sounds like you used it for output before you tried to run the input tasks. The first input task successfully reconfigures one nibble from output to input, but one of the other input tasks fails to reconfigure the other nibble because the first input task is still running.

 

The error message explains how to work around this limitation of the NI 9401: use DAQmx Control Task to reserve all NI 9401 tasks before you commit any of the tasks. Here's a knowledgebase that links to examples of how to do this: Why Do I Get Error 201133 When Trying To Perform Bidirectional DI/O with My NI 9401 in DAQmx?

 

Brad

---
Brad Keryan
NI R&D
0 Kudos
Message 2 of 12
(9,287 Views)

Hi brad,Thanks a lot for the reply.I never used NI 9401 module for output i only used it for input.

Let me try what u have suggested.

 

Thanks and regards

Vikas

0 Kudos
Message 3 of 12
(9,279 Views)

Hi

 

sorry for sucha a late response to the thread.I am trying to acuire digital pulse using NI 9401 and I was getting error.I was advised to use control task and i did the same.Now I am able to acuire data from all four flowmeters.but now I am geting differnt counts than what I supposed to get.When I am running them individually i am getting write counts and when I am using control task and reserving all the task I am getting very hih counts,

 

Please help

 

 

0 Kudos
Message 4 of 12
(9,235 Views)

Hi vnarang,

 

Could you be more specific about what your program does and what the results are?

 

Brad

---
Brad Keryan
NI R&D
0 Kudos
Message 5 of 12
(9,229 Views)

Hi Brad

 

Thanks for your time. I actually trying to acquire flow thru four hall effect flow meters.Flow meters produce 330 pulse per gallon.I am using NI 9401 to acuire the digital input ,mounted on NI 9178 chassis.

 

Flow meters needs 5 v dc power supply and signal output from the flow meter is current sinking so I have connected a resistor between + 5 V and output signal of he flow meter.

 

I have attcahed the Vi which I am using to acquire the flow.I am getting error 201133. i am confused why I am getting this error as I am not using  NI 9401 bidirectional,For the time being I tried to reserve task(which doesnt make sense to me for the reason i am not using 9401 bidirectional still i am doing as getting error) using control max and I am not getting rite counts.Please help me in knowing why I am getting error 201133 even I am configuring NI 9401 for only input,seondly if I am using control task why I am not getting write counts,

 

I have attached vi for your reference.

 

Best regards

 

Vikas

0 Kudos
Message 6 of 12
(9,222 Views)

Hi Vikas,

 

You need to reserve all of the tasks before starting any of the tasks. In LabVIEW, this requires using dataflow or sequence structures to control the order in which your code executes. Completely parallel tasks with no dataflow or sequence dependencies execute in whatever order LabVIEW decides they should execute. This means your program might be starting one task before reserving another.

 

If you want the counters to start counting at the same time, you need to synchronize them using an arm start trigger. Unfortunately, I don't know of a good example demonstrating this. Maybe someone else has a suggestion?

 

I don't know why you aren't getting the right counts. What counts are you getting? What counts did you expect? Are they wrong on all channels, or just some?

 

Also, I see you have uninitialized shift registers. Those remember their value across multiple runs of the VI. You might want to initialize those to 0 instead. Moving the task creation/clearing outside the loop is usually a good idea, too--start the tasks once, read multiple times, clear once.

 

Brad

---
Brad Keryan
NI R&D
0 Kudos
Message 7 of 12
(9,218 Views)

Hi Brad

 

I am getting very high counts i am supposed to get max of 30 counts per second,but when I am running with reserving the task ,I am getting counts in 1000 per second and also my program is slow.and its updating counts every 30 second.

 

I have attached my vi,I made this using counting digital events v shown in example its working perfectly fine but when I do the same thing in all the four flow meters,everything goes wrong.I dnt knw wts wrong

Please advise something,this is so irritating

 

0 Kudos
Message 8 of 12
(9,198 Views)

Was anybody able to find a solution to this?  I found something that may help.

http://www.ni.com/example/28575/en/

 

0 Kudos
Message 9 of 12
(6,703 Views)

There are several spots on this forum and the knowledgebase that more or less deal with this issue. So far no complete story found.

I recently solved  a comparable problem that occurs with three counters on the cDAQ NI 9185. (Because it is more than 2 )

Error -201133. Trouble reserving resources. Counters.

It's complicated.  I'd like to drop the vi that worked here and save other users a lot of time.

Also see: https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z000000P6TtSAK&l=nl-NL

Message 10 of 12
(1,167 Views)