08-24-2009 02:16 PM
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 DIChannelfilteredChannel = 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 DaqExceptionmyTask.Dispose()
MessageBox.Show(exception.Message)
End Try
End Sub
08-25-2009 04:58 PM
08-26-2009 08:38 AM
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
08-27-2009 03:40 PM
08-27-2009 04:20 PM
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
08-28-2009 11:04 AM