05-17-2011 02:01 PM
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
Solved! Go to Solution.
05-18-2011 09:23 AM
Try doing a Spy Capture and see what calls are made. Here's how to get started with Spy.
05-18-2011 03:00 PM
Michelle,
I found I need add viWritebuff to *IDN the equipment then it will reply an accepted message.
Thanks
Xin