Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

How to create a mutliple tasks to read Digital channels

Solved!
Go to solution

We are trying to monitor several 8 bit ports  on a NI PXIe-6535 from different Task() objects using the  DAQMX .NET libraries.

We thought we could create a task for PXI1Slot2/port0 and one for PXI1Slot2/port1. Each task would specify different edge bit conditions that would result in a

unique DigitalChangeDetectionEventHandler being called. This way we know which port saw the change.

 

No matter what we enter for the .DIChannels.CreateChannel() lines parameter we get a "Resource requested by this task has already been reserved by a different task" exception. It seems we can only have one task per PXIe-6535  device. We thought we could have one task per port.

 

Each task contains only 1  DigitalChangeDetection callback so we cannot create multiple channels per task, The callback event arguments don't indicate anything that tell you what port or channel was involved.

 

What are we missing ?

 

 

 

0 Kudos
Message 1 of 13
(6,151 Views)

Can you create the tasks you want in NI-MAX?

0 Kudos
Message 2 of 13
(6,145 Views)

I am new to all this so I don't even know what that means. I am able to create up to 5 test panels in MAX with each panel monitoring one 8 bit port.

0 Kudos
Message 3 of 13
(6,143 Views)

I went to MAX and created 3 tasks that all appear to be running at the same time.

 8 bit input task on port 0

 8 bit input task on port 1

32 bit input task on ports 0-3

 

Why can't I do this in C#?

0 Kudos
Message 5 of 13
(6,123 Views)

You may want to see if you get more help on the DAQ forum even though yours is a software question.

 

I have only worked with DAQs in LabVIEW.

0 Kudos
Message 6 of 13
(6,116 Views)

HI,

 

One option is to use the DAQ taks that you created in NI-MAX in your C# application

 

 

Curt

0 Kudos
Message 7 of 13
(6,111 Views)

I was wondering if you can do that. Do you specify the named task in the Task() constructor?

0 Kudos
Message 8 of 13
(6,108 Views)

 

This what I get when I try that.

 

{Error=0xfffcf267 Message="Task name specified conflicts with an existing task name.\n\nTask Name: DIO_PORT0_4\n\nStatus Code: -200089"}

0 Kudos
Message 9 of 13
(6,107 Views)