From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Read Digital-IN channels continuously and write Digital-OUT values sporadically (Status code: -201105)

Hello Friends

 

I have a NI 9403 device which I try to program in C#. It has 32 lines, which could be configurated for input or output separately.

 

First 0 - 15 lines are defined as input and 16 - 31 for output in separate tasks.DigiIn.JPGDigiOut.JPG

 

The simple task is, to read input channels continuesly in a thread and sporadically write values into output channels.

If I use tasks created in MAX, everything works fine, but only if they both are set to "1 Value (On Demand)". But as I tryed to create task in C# I recognized that required SampleQuantityMode = "1 Value (On Demand)" is not available! If I choose anything else for DigitalOut_Task, the software throws an error.


Resource requested by this task has already been reserved by a different task with conflicting settings.

Unreserve any other tasks using this device, or change their settings to be compatible with this task.

Task Name: Digital_Out_Task_16

Status Code: -201105

 

You can try it in MAX also:

1. Create Digital In Task for Line0 and set it to values available in SampleQuantityMode like ContinuousSamples or FiniteSamples

DI0.JPG
2. Create Digital Out Task for Line16 and set it to values available in SampleQuantityMode like ContinuousSamples or FiniteSamples

DO_16.JPG
PS: HardwareTimedSinglePoint seems not be supported by my card...

3. Try to execute tasks in MAX...


I try to fix it since 2 days, but cannot find any solution.... Why I cannot use "1 Value (On Demand)" in C# code?

 

I also attached my test program.

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

I found out, If I use Input Task created in MAX with "1 Value...", then I am able to create my Digital In Task in C# without problems.

 

Attached the newest Version of the software.

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

So, we clarified the problem. My card NI 9403 does not support this function fully.

 

If I set the samplerate to a one which I need and timing to ContinuousSamples, then I am able to receve OR send the data in a given frequency.

 

If I want to send AND receve data, I have to do it in a WHILE loop on software side... just by reading current values. On my machine it would be around 500Hz...

 

The solution is, to bu a different type of card NI 9401, which has only 8 channels, but each of them can be configurate for IN or OUT as needed. This card can read data with a given frequency and send data sporadically.

 

All this we found out together with an NI Supporter.

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