Visual Basic Example
A-8 PN: 10580-00306 Rev. E MS20xxC PM
stat = viOpen(dfltRM, "TCPIP0::" & ipAddress & "::" & Port &
"::SOCKET", VI_NULL, VI_NULL, sesn)
Rem Set some visa attributes
Rem recommandation timeout >= 90 sec
stat = viSetAttribute(sesn, VI_ATTR_TMO_VALUE, 90000)
stat = viSetAttribute(sesn, VI_ATTR_SEND_END_EN, VI_TRUE)
Rem VI_ATTR_SUPPRESS_END_EN has to set to False during Ethernet
Socket communication
stat = viSetAttribute(sesn, VI_ATTR_SUPPRESS_END_EN, VI_FALSE)
stat = viClear(sesn)
Rem NOTE:
Rem All commands (SCPI) must be send with linefeed
Rem during Ethernet Socket communication
Rem i.e. "vbLf" is in Visual Basic environment constant
'read back the strat frequency
sInputString = "*IDN?" & vbLf
stat = viWrite(sesn, sInputString, Len(sInputString), retCount)
Buffer = ""
stat = viRead(sesn, Buffer, MAX_CNT, retCount)
'System preset
sInputString = ":SYSTEM:PRESET" & vbLf
stat = viWrite(sesn, sInputString, Len(sInputString), retCount)
'Wait for previous operation to be completed
sInputString = "*OPC?" & vbLf
stat = viWrite(sesn, sInputString, Len(sInputString), retCount)
Buffer = ""
stat = viRead(sesn, Buffer, MAX_CNT, retCount)
'Set start frequency
sInputString = ":SENSe:FREQuency:STARt 1 GHz" & vbLf