From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Want to know the NI-VISA command in measurement and automation explorer

Solved!
Go to solution

Hi,

 

I use Measurement and automation explorer to connect my equipment through LAN and it works well.

 

But my VBA code with Ni-VISA can't detect this equipment. I want to know how the software ( Measurement and automation explorer) generates the connection and read back the buff message inside the equipment.

 

 

This is my code. I check the readback value if it is "100 connection accepted",
----
Public Function VNAconnection() As Boolean
stat = viOpenDefaultRM(defaultRM)
msDly (1000)
stat = viOpen(defaultRM, "TCPIP0::10.85.148.60::5000::SOCKET", VI_NULL, 20000, sesn)
msDly (1000)
stat = viSetAttribute(sesn, VI_ATTR_TMO_VALUE, 15000)
msDly (1000)
feedbk = Space(80)
status ("Waiting for VNA connection")
stat = viBufRead(sesn, feedbk, Len(feedbk), Actual_Length)
If InStr(Left(feedbk, Actual_Length), "accepted") = 0 Then

MsgBox "Error Occured. Ethernet connection not accepted!"
viClose sesn

viClose defaultRM

VNAconnection = False

Exit Function

End If
End Function

 

Thanks

0 Kudos
Message 1 of 3
(2,878 Views)

 

Try doing a Spy Capture and see what calls are made. Here's how to get started with Spy.

--Michelle

National Instruments
0 Kudos
Message 2 of 3
(2,866 Views)
Solution
Accepted by topic author xinli

Michelle,

 

I found I need add  viWritebuff to *IDN the equipment then it will reply an accepted message.

 

Thanks

 

Xin

0 Kudos
Message 3 of 3
(2,861 Views)