Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Change Detection on single line don't work C#

Hi, 

I'm trying to developp an application to detect the change in a single line of my NI USB-6212.

My code is this:

 

// Create the task.
myTask = new Task();

// Create channel
string channelName = "Dev1/port0/line0";
myTask.DIChannels.CreateChannel(channelName, "", ChannelLineGrouping.OneChannelForEachLine);

// Configure digital change detection timing
myTask.Timing.ConfigureChangeDetection(channelName, channelName, SampleQuantityMode.ContinuousSamples, 1000);
myTask.SynchronizeCallbacks = true;
myTask.DigitalChangeDetection += MyTask_DigitalChangeDetection;

// Create the reader
myDigitalReader = new DigitalSingleChannelReader(myTask.Stream);

// Start the task
myTask.Start();

But when I run the code line: 

myTask.Timing.ConfigureChangeDetection(channelName, channelName, SampleQuantityMode.ContinuousSamples, 1000);

I  have this exception: 

Error=-200077

Message="Requested value is not a supported value for this property. The property value may be invalid because it conflicts with another property."

Property: NationalInstruments.DAQmx.Timing.SampleTimingType

Requested Value: NationalInstruments.DAQmx.SampleTimingType.ChangeDetection

Possible Values: NationalInstruments.DAQmx.SampleTimingType.OnDemand

Task Name: _unnamedTask<0>

Status Code: -200077

 

Does anyone have any idea what is the problem ?

 

Thank you in advance for your answers

 

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

Hello,

unfortunately this is an expected behavior. 

The USB-6212 doesn't support the HW change detection feature.

What are you trying to do? Why HW change detection?

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

Thank you for the reply..

I wanted to check some emergency sensors and report any anomalies if they change status without having to constantly check them through my software.

My solution will be my background task that will control the state of the lines every X time.

 

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