Quantcast
Channel: Instrument Control (GPIB, Serial, VISA, IVI) topics
Viewing all articles
Browse latest Browse all 5565

VB.net MessageBasedSession questions

$
0
0

I am trying to convert the SimpleReadWrite(located C:\Users\Public\Documents\National Instruments\NI-VISA\Examples\.NET\SimpleReadWrite)  C code example for talking to a USB device and I am having some issues, the example work fine it just may be my conversion may be wrong any help would be apreciated.

 

This is the code I have,

 

 

Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
        Try
            Dim rscName As String = "USB0::0x0B21::0x0025::4332514C323730353856::INSTR" 'Actaul name of resource

            Dim rm As ResourceManager = New ResourceManager()

            mbSession = DirectCast(rm.Open(rscName), MessageBasedSession)


            Dim textToWrite As String = "*IDN?\n" 'Standard ID query

            mbSession.RawIO.Write(textToWrite)

            Me.ListBox1.Items.Add(mbSession.RawIO.ReadString())


        Catch ex As Exception
            GenPrcs.ErrorHndl(ex)
        End Try
    End Sub

 

everything works fine until the mbsession.rawio.readstring and then i get this error

 

Capture4.JPG

 

again any help would be much aprriciated. Thanks and have a great day


Viewing all articles
Browse latest Browse all 5565

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>