Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

How to create a multiple tasks to continuously read Digital channels?

Hi NI Community,

 

I am currently experiencing a problem where if I try to create multiple tasks that each continuously read from different digital input channels, I get the following exception: 

 

The specified resource is reserved. The operation could not be completed as specified.

 

This only happens once I start the second task. Is it not allowed to continuously sample from two digital input tasks simultaneously?

 

I am using an NI USB-6509 device, which has 96 channels.

 

The workaround would thus be to add all channels to one task and continuously sample from there, but would require a bit of rework. I also don't particularly like the concept of that approach, since all of my outputs are set as individual tasks per output channel port. In other words, I would like to use one task per port of 8 pins, regardless of whether it's an input or output port. All my pins are set up as digital. I need to continuously measure the input pins in order to have an event fire when an input pin changes state.

 

If you require any source code to take a look, let me know. I don't just want to dump all of it here.

 

Thank you in advance.

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

Hey rcnieuw,

 

There is only one timing engine available on the USB-6509 for the digital inputs/outputs so, all of your digital inputs/outputs must be in the same task.

 

It’s unfortunate that this requires a bit of rework, but it’s going to be the best option moving forward

0 Kudos
Message 2 of 3
(2,407 Views)

Thanks Steven!

 

I figured that out as well and reworked my code to accommodate the device's limitation. All seems to be working fine now.

0 Kudos
Message 3 of 3
(2,399 Views)