Remote Control
R&S
®
ESRP
575
User Manual 1175.7445.02 ─ 08
Initialization and Default State
At the start of each program, the global variables used by all subroutines must be cre-
ated. The remote control and the instrument settings will then be changed to a defined
default state. The two subroutines InitController and InitDevice are used for this.
Creating Global Variables
In Visual Basic, global variables are stored in modules (data extension
.BAS
). Thus, at
least one module (e.g.
GLOBALS.BAS
) must be created that contains the variables
used by all subroutines, e.g. the variables for device addresses used by the remote
control driver.
For all example programs shown below, the file must contain the following instructions:
Global analyzer As Long
Global defaultRM As Long
Initializing the Remote Control Session
REM ------------ Initializing the remote control session -------------------
Public SUB Initialize()
Dim status As Long
'CALL viOpenDefaultRM to get the resource manager handle
'Store this handle in defaultRM. The function viStatusDesc
'returns a text description of the status code returned by viOpenDefaultRM
status = viOpenDefaultRM(defaultRM)
status = viStatusDesc(defaultRM, status, Response)
'Open the connection to the device and store the handle
'Note: The timeout value in viOpen() applies only for opening the interface
'For setting the communication timeout, set the VI_ATTR_TMO_VALUE attribute
'timeout values are in milliseconds
'This example assumes the instrument IP address 10.0.0.10
'If the network provides a name resolution mechanism, the hostname of
'the instrument can be used instead of the numeric IP address
'the resource string for GPIB would be "GPIB::20::INSTR''
status = viOpen(defaultRM, "TCPIP::10.0.0.10::INSTR'', 0, 1000, analyzer)
'status = viOpen(defaultRM, "TCPIP::<hostname>::INSTR'', 0, 1000, analyzer)
'status = viOpen(defaultRM, "GPIB::20::INSTR'', 0, 1000, analyzer)
'Set timeout value - here 5s
status = viSetAttribute(vi, VI_ATTR_TMO_VALUE, 5000)
END SUB
REM ***********************************************************************
Initializing the Instrument
Set the remote control status registers and instrument settings to the default state.
REM ------------ Initializing the instrument -------------------------------
Public SUB InitDevice()
CALL InstrWrite(analyzer, "*CLS") 'Reset status register
CALL InstrWrite(analyzer, "*RST") 'Reset instrument
Controlling the R&S
ESRP Remotely