05-20-2019 08:27 AM - edited 05-20-2019 08:38 AM
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.
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
2. Create Digital Out Task for Line16 and set it to values available in SampleQuantityMode like ContinuousSamples or FiniteSamples
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.
06-19-2019 10:46 AM
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.
07-03-2019 07:11 AM - edited 07-03-2019 07:29 AM
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.