Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Why can't "viFindRsrc" find the instrument?

Solved!
Go to solution


viOpenDefaultRM(defrm)
Dim find_list As Integer
Dim retCnt As Integer
Dim instrDesc As String 
status = viFindRsrc(defrm, "?*INSTR", find_list, retCnt, instrDesc)
' status = viStatusDesc(defrm, status, instrDesc)
VI_txtEXM.Text = instrDesc
status = viClose(defrm) 

This code  find the instrument!

 

 

To update:

After the address is initialized, the address can be found. But there is only one.——TCPIP0::K-E5052B-02402.lan::inst0::INSTR

But there are several instruments here.

The most important thing is that this address can not be connected!!!!!

 

Dim instrDesc As String = "00000000000000000000000000000000000000000000000000000000000000000"

0 Kudos
Message 1 of 4
(2,935 Views)

status,find_list,retCnt——Their return value is 0.

 

then I try to use "viFindNext" to find other instrument

status = viFindNext(find_list, instrDesc)

then return:VI_ERROR_INV_OBJECT

meybe because "find_list"=0

0 Kudos
Message 2 of 4
(2,918 Views)
Solution
Accepted by topic author xiaochouyu

It has been solved! The problem is that the default value in "Declare" is different from VB and VB.NET. VB is defaults to "ByRef" while VB.NET defaults is "ByVal". The problem was solved after being changed to "ByRef".

 

 

 

Declare Function viFindRsrc Lib "VISA32.DLL" Alias "#129" (ByVal sesn As Integer, ByVal expr As String, vi As Integer,  retCount As Integer, ByVal desc As String) As Integer

 

Declare Function viFindRsrc Lib "VISA32.DLL" Alias "#129" (ByVal sesn As Integer, ByVal expr As String, ByRef vi As Integer, ByRef retCount As Integer, ByVal desc As String) As Integer

0 Kudos
Message 3 of 4
(2,911 Views)

A new problem is that the number of instrument lists is not the same as the number of instruments used by IO Control.
I can search for TCPIP0::K-E5052B-02402.lan::inst0::INSTR, but I cannot search for TCPIP0::192.168.1.253::inst0::INSTR

I can only search for seven. But IO Control can search 14.

 

The instrument address I searched for:

TCPIP0::KEYSIGH-FHPNKCU.lan::hislip0::INSTR
TCPIP0::KEYSIGH-FHPNKCU.lan::inst0::INSTR
TCPIP0::K-E5052B-02402.lan::inst0::INSTR
ASRL1::INSTR
ASRL2::INSTR
ASRL3::INSTR
ASRL8::INSTR

 

Instrument address found using official tools:

TCPIP0::192.168.1.253::inst0::INSTR

TCPIP0::192.168.1.82::inst0::INSTR

TCPIP0::192.168.3.3::hislip0::INSTR

TCPIP0::KEYSIGH-FHPNKCU.lan::hislip0::INSTR
TCPIP0::KEYSIGH-FHPNKCU.lan::inst0::INSTR

TCPIP0::KEYSIGH-FHPNKCU.lan::5025::SOCKET
TCPIP0::K-E5052B-02402.lan::inst0::INSTR

TCPIP0::K-E5052B-02402.lan::5025::SOCKET
ASRL1::INSTR
ASRL2::INSTR
ASRL3::INSTR
ASRL8::INSTR

TCPIP[board]::host address[::LAN device name][::INSTR]

TCPIP[board]::host address::port::SOCKET

0 Kudos
Message 4 of 4
(2,902 Views)