Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

Trouble with NI9403 using Input and Output mix in same module

Solved!
Go to solution

Hi, I am working with a cDAQ9189 and I have 3 modules attached. One  NI9205, other NI9403 and a NI9265. I made recently and a application with them and I use the example about continuous acquisition and data-logging. All works fine. I use NI9403 like output. 

Now I got a problem. I need to use NI9403 with some pins like Input and some like output. In a mix. And read them and withe them. 

Here I configure In and OutsHere I configure In and Outsthis are inthis are inthis are outsthis are outsread and writeread and write  

This are pictures with the way I configure this module NI9403. The main trouble it is that at begging I got and error that In and Out couldn't use same task. Well I separated like pictures and add the option reserved I found to solve troubles with 9401. Well, now I got and error that I could not use 2 task for same module.

So , I don't know how to solve it.

Any advise. 

I attached the Vi

Thanks, regards

     

 

0 Kudos
Message 1 of 3
(2,252 Views)

HI Juan Manuel,

 

As you mentioned, using the DAQmx Control Task VI to reserve all the tasks before could help to solve the problem, as shown in the following article: https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z000000P6TtSAK&l=en-US

Note that in the example in the article, they are initializing the outputs  and inputs separately, so at the end they have two different tasks (one for the inputs and another one for the outputs). You might need to change a bit your implementation.

I think this should allow you to configure the inputs and the outputs in the same device, but using two different tasks.

 

As I understand from your code, you have a subVI to configure the lines of the module as inputs and another one to configure the lines as outputs. Instead of having a subVI with a for cycle inside you can pass the array containing the lines to a DAQmx Flatten Channel String VI and then pass the output of this VI directly to the DAQmx Create Channel VI, with the same result as in your subVI, this would improve your code a bit. After doing this, you can wire the output task to from the DAQmx Create Channel VI to the Control Task VI to reserve the task before initializing, like they do in the article. After initializing both tasks, you will be able to read or write on each task individually.

I hope this help you Juan Manuel! 

Regards

Message 2 of 3
(2,011 Views)
Solution
Accepted by topic author juanmanuelveng

Thanks Juanjo_B, I found that the main trouble was that I write input and output with a Int32. When I change this to an array of bits with the size of the input and output set, the error disappear.   

0 Kudos
Message 3 of 3
(1,991 Views)