Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

What can be making DigitalChangeDetection stop detecting?

I have been using DigitalChangeDectection, mostly with success, but once in a while it just stops detecting digital changes and/or the event handler stops handling the events. There is nowhere in the program where I remove the handler. I use the sub below to start change detection, which was mostly copied from an NI example. What can be making it stop detecting changes?

 

 

 

 Public Sub StartChngDetectAllDIPorts()

  Try

      ' Create the task

      myTask = New Task()

      ' Create channel

       Dim filteredChannel As DIChannel

      filteredChannel = myTask.DIChannels.CreateChannel(AllInputPorts, "", ChannelLineGrouping.OneChannelForAllLines)

      ' Configure digital change detection timing

      myTask.Timing.ConfigureChangeDetection(AllInputPorts, AllInputPorts, SampleQuantityMode.ContinuousSamples)

      filteredChannel.DigitalFilterEnable = True

      filteredChannel.DigitalFilterMinimumPulseWidth = DigFilterPW

      ' Use SynchronizeCallbacks to specify that the object marshals callbacks across threads appropriately.

      myTask.SynchronizeCallbacks = True

        ' Add the digital change detection event handler

       AddHandler myTask.DigitalChangeDetection, AddressOf myTask_DigINPortChangeDetection

      ' Create the reader

      myDigitalReader = New DigitalSingleChannelReader(myTask.Stream)

      ' Start the task

      myTask.Start()

  Catch exception As DaqException

      myTask.Dispose()

      MessageBox.Show(exception.Message)

  End Try

End Sub

0 Kudos
Message 1 of 6
(4,015 Views)
When you say that it stops change detection is your program still running, its just no longer detecting the events, do you receive an error, what specifically is happening?  What hardware are you using?  If you just run the NI example that you mention does it detect events no problem.  Can you confirm by possibly scoping the input line that the signal coming in is correct?
Doug Farrell
Solutions Marketing - Automotive
National Instruments

National Instruments Automotive Solutions
0 Kudos
Message 2 of 6
(4,001 Views)

Doug,

 

The program continues to run. In fact the only thing funky that happens is it stops detecting input changes. I have verified that the input signals are still there (and changing). I'm using a PCI-6515, sorry for not mentioning that. I haven't tried running just the example code. I'll give that a try, but it could take a long time to confirm anything since it doesn't happen consistently.

 

Tim

0 Kudos
Message 3 of 6
(3,991 Views)
If you try an example are seeing the same behaviour I would recommend you contact NI support, as it sounds like it could be a problem with the hardware.  I know the problem can take a while to manifest itself, but do you ahve any other cards you could try the code with?
Doug Farrell
Solutions Marketing - Automotive
National Instruments

National Instruments Automotive Solutions
0 Kudos
Message 4 of 6
(3,975 Views)

Doug,

 

I discovered that the problem occurs after the computer goes into standby and then wakes up. I'm not sure if I should be surprised by this. Obvious I could set it up so that the computer doesn't go into standby after a certain amount of time. Also, I see that after the computer wakes up, I can restart the task and it starts working again (detecting DO changes). Do you know of any downside to doing this?

 

Tim

0 Kudos
Message 5 of 6
(3,973 Views)
I think you figured out this beastie.  What I would see happening is that when the computer goes into standby the task is stopping and it needs to be restarted.  I would just disable standby mode.
Doug Farrell
Solutions Marketing - Automotive
National Instruments

National Instruments Automotive Solutions
0 Kudos
Message 6 of 6
(3,957 Views)