Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

How to control two devices with GPIB-UBS-HS+ in VB 2019 ?

Solved!
Go to solution
Highlighted

Hai, I am working with Visual Basics 2019 to control two devices using GPIB-USB-HS+. I could control one device by following syntax.

 

Imports NationalInstruments.VisaNS

 

Dim GPIB_ResourceString1 As String

 

GPIB_ResourceString1 = "GPIB0::8::INSTR"

mbSession = CType(ResourceManager.GetLocalManager().Open(GPIB_ResourceString),

MessageBasedSession)

 

mbSession.Write("OUTX 0 ;")

 

response = mbSession.Query("OUTX ?").

 

Then how to control two devices with GPIBs? I could connect the two devices using two GPIBs, but not able to send command and read the response from a specific device. Can anyone help me in this? Thank you in advance.

0 Kudos
Message 1 of 3
(208 Views)
Solution
Accepted by topic author Rajeshgp

Firstly, if you are just starting out with this code then NI advises not using NationalInstruments.VisaNS but switch to Ivi.Visa. The syntax is very similar.

 

Secondly, unless I am missing the point of your question. You just need the one GPIB controller and do this for the second instrument:

Dim GPIB_ResourceString2 As String

 

GPIB_ResourceString2 = "GPIB0::16::INSTR"

mbSession2 = CType(ResourceManager.GetLocalManager().Open(GPIB_ResourceString2), MessageBasedSession)

 

mbSession2.Write("OUTX 0 ;")

 

response2 = mbSession2.Query("OUTX ?").

0 Kudos
Message 2 of 3
(154 Views)

Thank you for the reply, It works. We also need to define mbsession2 As MessageBasedSession. 

0 Kudos
Message 3 of 3
(79 Views)