03-10-2009 11:44 AM - edited 03-10-2009 11:45 AM
Hallo ,
I am trying to use the following code of vb.net to read the channel of a PCI-NI6509. and i get the following error: Taskname specified confilicts with an existing task name status code:-200089
Is my code correct? i did close the channel everytime after i read .
Public Class NI_DIO
Public Function ReadChannel(ByVal Channel As Integer) As UInt32
Dim ReadTask As Task = New Task( "DigitalReadTask" )
Dim xData As UInt32
Try
Dim P As String = "Dev1/port" & (4 * Channel) & "_32"
ReadTask.DIChannels.CreateChannel(P, "port0", ChannelLineGrouping.OneChannelForAllLines)
Dim reader As DigitalSingleChannelReader = New DigitalSingleChannelReader(ReadTask.Stream)
xData = reader.ReadSingleSamplePortUInt32()
ReadTask.Dispose()
Catch ex As DaqException
Finally
ReadTask.Dispose()
End Try
Return xData
End Function
End Class
03-11-2009 05:46 AM