®
R&S
FSVR
Pour les exemples de programmation suivants, le fichier doit contenir les instruc-
tions ci-après :
Global analyzer As Long Global defaultRM As Long
7.1.2.2
Initialisation de la session de commande à distance
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.
'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 ***********************************************************************
7.1.2.3
Initialisation de l'instrument
Placez le registre d'état de la commande à distance et les réglages de l'appareil sur
leur état par défaut.
REM ------------ Initializing the instrument -------------------------------
Public SUB InitDevice()
CALL InstrWrite(analyzer, "*CLS")
CALL InstrWrite(analyzer, "*RST")
END SUB
REM*************************************************************************
Guide de démarrage rapide 1311.0670.63 ─ 03
Brève introduction à la commande à distance
Étapes de base de la programmation en commande à distance
The function viStatusDesc
'Reset status register
'Reset instrument
149