Hello--
I'm having an issue where a ReadSingleSampleInt32 call results in an error. Some background:
I have a counter which counts pulses. It gets initialized/started as follows:
CountPulseTask = New Task() CountPulseTask.CIChannels.CreateCountEdgesChannel("/" & DAQName & CountPulseCounter, _ "CountPulses", CICountEdgesActiveEdge.Rising, 0, _ CICountEdgesCountDirection.Up) CountPulseTask.CIChannels.All.CountEdgesTerminal = "/" & DAQName & PressurePulseOutputChannel CountPulseReader = New CounterSingleChannelReader(CountPulseTask.Stream)
CountPulseTask.Start()
Then, every 100ms (via .NET timer control), I obtain the count as follows:
Public Function GetCount(ByRef ErrMsg As String) As Long Dim tmpCount As Long Try tmpCount = CountPulseReader.ReadSingleSampleInt32() Catch ex As Exception 'CountPulseTask.Dispose() ErrMsg = ex.Message GetCount = ErrLong Exit Function End Try GetCount = tmpCount End Function
I've got an intermittent but reliable situation where the GetCount sub throws an exception--sometimes after 8k counts, sometimes after millions of counts. I haven't seen this issue on my dev system, but my client has seen the error on their deployment system. As a result, debug information is limited--I know that makes diagnosis very difficult.
But i'm wondering if anyone is aware of any reasons why a ReadSingleSampleInt32 call would work fine for millions of cycles, and then all of a sudden throw an exception. Not knowing the specific error, it's been hard to search the forums for possibilities. I can confirm with near certainty that the counter task is still valid and running.
Any thoughts would be greatly appreciated.
Thanks!
Sandheep