10-15-2024 12:42 AM
Hello,
I have an issue with the change detection in the NI-9423 module, and maybe more specifically the DAQmx .net driver.
I configure the change detection like this:
_diParallelTask = new NationalInstruments.DAQmx.Task();
_diPhysicalChannels = daqSystem.GetPhysicalChannels(PhysicalChannelTypes.DIPort, PhysicalChannelAccess.External);
_diParallelTask.DIChannels.CreateChannel(_diPhysicalChannels[0], "", ChannelLineGrouping.OneChannelForAllLines);
_diParallelTask.Timing.ConfigureChangeDetection(
_diPhysicalChannels[0],
_diPhysicalChannels[0],
SampleQuantityMode.ContinuousSamples,
1000
);
_diParallelTask.SynchronizeCallbacks = false;
_diParallelTask.DigitalChangeDetection += new DigitalChangeDetectionEventHandler(_diParallelTask_DigitalChangeDetection);
_diParallelTask.Stream.Timeout = 10;
_diParallelTask.Control(TaskAction.Verify);
_diParallelTask.Start();
This works fine, and the changes are correctly detected by the module. After some time though (around half to one hour), the detection events simply stop, without any exception being thrown. Re-initializing usually fixes the issue, but sometimes it seems I have to do both that and reboot the device I have connected to the module.
I tried to disable the detection in my code and use the NI provided C# example for change detection instead, but the same happens there. However, when using NI-MAX:s Test Panel feature, I cannot replicate the issue. This leads me to think the issue may lie with the DAQmx .Net library, or the Test Panel doesn't use change detection at all.
It seems the issue is more easily reproduced when I change the powering mode in the device I have connected to the module, or do many power on - power off cycles.
In the detection function, I read the value like this "_fastInputStates = reader.ReadSingleSamplePortByte();" and then do some logic to determine which inputs have changed.