R&S ESU
Brief Introduction to Remote Control
Basic Steps in Programming using the VISA Interface
7.8
Quick Start Guide 1302.6163.62 - 04
7.1.6 Command Synchronization
The synchronization methods used in the following example are described in the Operating
Manual, chapter 5, section "Command Sequence and Command Synchronization".
REM -------- Commands for command synchronization ------------------------
PUBLIC SUB SweepSync()
Dim status As ViStatus
Dim retCnt As Long
Dim etype As ViEventType
Dim eevent As ViEvent
Dim stat As Integer
Rem The command INITiate[:IMMediate] starts a single sweep if the
Rem command INIT:CONT OFF has already been sent. The next command
Rem must not be carried out until a full sweep has been completed.
status = viWrite(analyzer, "INIT:CONT OFF", 13, retCnt)
REM -------- First method: Using *WAI ------------------------------------
status = viWrite(analyzer, "ABOR;INIT:IMM;*WAI", 18, retCnt)
REM -------- Second method: Using *OPC? ----------------------------------
OpcOk$ = Space$(2)
status = viWrite(analyzer, "ABOR;INIT:IMM; *OPC?", 20, retCnt)
'Provide space for *OPC? response
REM In this case, the controller can use other instruments:
status = viRead(analyzer, OpcOk$, 2, retCnt)
'Wait for "1" from *OPC?
REM -------- Third method: Using *OPC ------------------------------------
Rem In order for the Service Request function to be used with a GPIB
Rem driver from National Instruments, the setting
Rem "Disable Auto Serial Poll" must be set to "yes" with IBCONF!
status = viWrite(analyzer, "*SRE 32", 7, retCnt)
'Enable Service Request for ESR
status = viWrite(analyzer, "*ESE 1", 6, retCnt)
'Set event enable bit for operation complete bit
status = viEnableEvent(analyzer, VI_EVENT_SERVICE_REQ, VI_QUEUE, VI_NULL)
'Enable SRQ event
status = viWrite(analyzer, "ABOR;INIT:IMM;*OPC", 18, retCnt)
'Start sweep with synchronization to OPC
status = viWaitOnEvent(analyzer, VI_EVENT_SERVICE_REQ, 10000, etype, eevent)
'Wait for Service Request
status = viReadSTB(analyzer, stat)
status = viClose(eevent)
'Close event handler
status = viDisableEvent(analyzer, VI_EVENT_SERVICE_REQ, VI_QUEUE)
'Disable SRQ Event
REM Resume main program here.
END SUB
Service requests are only supported by GPIB and VXI instruments.
Summary of Contents for esu
Page 26: ...R S ESU Contents 6 Quick Start Guide 1302 6163 62 04 ...
Page 28: ......
Page 32: ...R S ESU 0 4 Quick Start Guide 1302 6163 62 04 ...
Page 88: ...R S ESU Preparing for Use Operating System Properties 2 38 Quick Start Guide 1302 6163 62 04 ...
Page 104: ...R S ESU Basic Operation Setting Parameters 4 12 Quick Start Guide 1302 6163 62 04 ...
Page 201: ...Quick Start Guide 1302 6163 62 04 R S ESU Appendix Appendix ...
Page 202: ...Quick Start Guide 1302 6163 62 04 R S ESU Appendix ...