01-31-2020 01:16 PM
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.
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
Solved! Go to Solution.
02-04-2020 04:47 PM
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
02-10-2020 06:47 AM
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.