Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

Error on ReadSingleSampleInt32

Highlighted

Error on ReadSingleSampleInt32

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

 

 

0 Kudos
Message 1 of 3
(64 Views)

Re: Error on ReadSingleSampleInt32

Hello!

Do you have any more information on the exception that is being thrown itself? Is it a DaqException or an OutOfMemoryException? 

Especially because this is happening at a client site (and not necessarily on your computer) it's possible that the computer they are running this on is less powerful than yours (less memory) or they have a lot of other operations running on the computer. This could lead to an out of memory exception. What does the resource usage look like on the client computer when the program is running?

ReadSingleSampleUInt32 Method:: http://zone.ni.com/reference/en-XX/help/370473J-01/ninetdaqmxfx40ref/html/m_nationalinstruments_daqm...

DaqException Class:: http://zone.ni.com/reference/en-XX/help/370473J-01/ninetdaqmxfx40ref/html/t_nationalinstruments_daqm...

R. Dahlman

0 Kudos
Message 2 of 3
(21 Views)

Re: Error on ReadSingleSampleInt32

R--

Thanks for the response!  I added some debug capabilities to the application running on my client's computer and discovered that an error handler for another procedure was causing the task to be stopped/disposed.  So...user error on my part.


thanks!

Sandheep

0 Kudos
Message 3 of 3
(12 Views)