Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Controlling instruments using USB and LAN

I have a simple program that I am trying to use to get a instruments status using VBA. I wanted to find out if it is possible to use VISA-Com 5.13 Type Library and have it be able to run with either a USB or LAN address.

My code uses UUT_Address as the USB or LAN address. When I declare UUT_Address as a USB address everything works, but when I declare it as LAN address I get an the following error. Is the VISA-COM 5.13 Type Library capable of this?

sokin_0-1673894677778.png

 

Dim RM As VisaComLib.ResourceManager
Dim VISACOMOBJ As VisaComLib.FormattedIO488
Dim list() As String
Dim timeout As Long: timeout = 50000 '5000msec

Set RM = New VisaComLib.ResourceManager
Set VISACOMOBJ = New VisaComLib.FormattedIO488
Set VISACOMOBJ.IO = RM.Open("UUT_Address", NO_LOCK, timeout)
With VISACOMOBJ
.IO.timeout = timeout

.WriteString "*RST" & vbLf, True

.IO.Close
End With

0 Kudos
Message 1 of 2
(710 Views)

Hello.

-2147221487 is the error code when the VISA resource was not found. (E_VISA_RSRC_NFOUND)

Specify a specific address such as TCP0::xxx.xxx.xxx.xxx::inst0::INSTR or please check if NI-MAX can recognize the target TCP resource.

0 Kudos
Message 2 of 2
(673 Views)