Rohde&Schwarz Remote Control via SCPI Getting started

Remote Control via SCPI Getting Started
(;Ý]ê2)
1179459202 Version 02
This manual applies to the Rohde & Schwarz products that support remote control via SCPI.
© 2022 Rohde & Schwarz GmbH & Co. KG
Phone: +49 89 41 29 - 0
Email: info@rohde-schwarz.com
Internet: www.rohde-schwarz.com
Subject to change – data without tolerance limits is not binding.
R&S® is a registered trademark of Rohde & Schwarz GmbH & Co. KG.
Trade names are trademarks of the owners.
1179.4592.02 | Version 02 | Remote Control via SCPI
Throughout this manual, products from Rohde & Schwarz are indicated without the ® symbol, for example, R&S®VISA is indicated as
R&S VISA.
ContentsRemote Control via SCPI

Contents

1 Introduction............................................................................................ 5
2 Remote control interfaces and protocols............................................ 6
2.1 LAN interface.................................................................................................................7
2.2 USB interface...............................................................................................................10
2.3 GPIB interface............................................................................................................. 10
2.4 Drivers for graphical programming interfaces.........................................................12
3 SCPI command structure.................................................................... 13
3.1 Syntax for common commands.................................................................................13
3.2 Syntax for instrument-specific commands.............................................................. 14
3.3 Command parameters................................................................................................ 15
3.4 Overview of syntax elements.....................................................................................18
3.5 Structure of a command line......................................................................................20
3.6 Responses to queries.................................................................................................20
4 Instrument messages.......................................................................... 22
5 Status reporting system......................................................................23
5.1 Overview of status registers...................................................................................... 23
5.2 Structure of a status register..................................................................................... 24
5.3 Contents of the status registers................................................................................ 26
5.4 Application of the status reporting system.............................................................. 28
6 General programming recommendations..........................................32
7 Command sequence and synchronization........................................ 33
7.1 Preventing overlapping execution............................................................................ 33
7.2 Examples..................................................................................................................... 35
8 Contacting customer support.............................................................36
Index......................................................................................................37
31179.4592.02 ─ 02
ContentsRemote Control via SCPI
41179.4592.02 ─ 02

1 Introduction

This document provides general information on remote control of Rohde & Schwarz products via SCPI, especially useful for unexperienced users.
For further information, refer to:
User manuals of your product
The description of manual operation (GUI reference) provides direct links to
corresponding remote commands.
For remote control interfaces and protocols supported by your instrument, refer
to chapters describing remote control basics.
For detailed description of the remote control commands that your instrument
supports, refer to the command reference chapters.
www.rohde-schwarz.com/rckb: Rohde & Schwarz webpage that provides informa-
tion on instrument drivers and remote control.
IntroductionRemote Control via SCPI
51179.4592.02 ─ 02
Remote control interfaces and protocolsRemote Control via SCPI

2 Remote control interfaces and protocols

Remote operation with SCPI commands automates the operation of the instrument. Scripts or programs control the software or firmware of the instrument to execute tests or generate signals.
SCPI stands for Standard Commands for Programmable Instruments. Typically, Rohde & Schwarz instruments support at least one interface for remote control via SCPI.
SCPI compatibility
The SCPI standard is based on standard IEEE 488.2. It aims at the standardization of instrument-specific commands, error handling and status registers. The tutorial "Auto­matic Measurement Control - A tutorial on SCPI and IEEE 488.2" from John M. Pieper (Rohde & Schwarz order number 0002.3536.00) offers detailed information on con­cepts and definitions of SCPI. The instrument supports the latest SCPI version 1999.
SCPI-confirmed commands are typically explicitly marked in the command reference chapters. Commands without SCPI label are instrument-specific. However, their syntax follows SCPI rules. See also Chapter 3, "SCPI command structure", on page 13.
VISA libraries
Virtual instruments software architecture (VISA) is a standardized software interface library providing input and output functions to communicate with instruments. High­level programming platforms use VISA as an intermediate abstraction layer. VISA encapsulates the low-level function calls and thus makes the transport interface trans­parent for the user.
A VISA installation is a prerequisite for remote control via the LAN, USB or GPIB. The I/O channel is selected at initialization time via the channel-specific address string or a VISA alias (short name). The VISA address resource strings are typically displayed in the GUI of the instrument.
For further information, refer to:
Rohde & Schwarz webpage providing the installers for a proprietary R&S VISA:
www.rohde-schwarz.com/rsvisa.
Rohde & Schwarz webpages providing examples on VISA tools:
R&S VISA Tester Tool: www.rohde-schwarz.com/visa-and-tools
Using R&S Forum Application for Instrument Remote Control: www.rohde-
schwarz.com/rs-forum
Rohde & Schwarz webpage VISA in Programming Languages: www.rohde-
schwarz.com/programming-with-visa
VISA user documentation
61179.4592.02 ─ 02

2.1 LAN interface

Many instruments are equipped with a LAN interface that can be connected via a com­mercial RJ-45 cable to a network with TCP/IP protocol. The TCP/IP protocol and the associated network services are preconfigured on the instrument. Software for instru­ment control and (for specified protocols only) the VISA program library must be instal­led on the controlling computer.
Rohde & Schwarz instruments support LAN protocols such as VXI-11, RSIB, raw socket or the newer HiSLIP protocol.
VISA resource string
Only the IP address or the host name of the instrument is required to set up a connec­tion. This information is part of the VISA resource string used to address the instru­ment. Several instruments in the same network have different IP addresses, host names and resource strings.
Default ports
Remote control interfaces and protocolsRemote Control via SCPI
LAN interface
Rohde & Schwarz instruments typically use the following ports for communication via LAN control interface.
Table 2-1: Typical default ports of LAN protocols
LAN protocol Default port number
VXI-11 protocol TCP or UDP port: 111
HiSLIP protocol TCP port: 4880
Socket communication raw socket, TCP port: 5025, 5125
RSIB protocol TCP port: 2525
mDNS / Bonjour® (LXI)

2.1.1 VXI-11 protocol

The VXI-11 standard is based on the open network computing remote procedure call (ONC RPC) protocol which in turn relies on TCP/IP as the network/transport layer. The TCP/IP network protocol and the associated network services are preconfigured.
TCP/IP ensures connection-oriented communication, where the order of the exchanged messages is adhered to and interrupted links are identified. With this proto­col, messages cannot be lost.
TCP port: any port provided by the ONC RPC port mapper (see RFC 1833)
TCP port: 5353

2.1.2 HiSLIP protocol

The high-speed LAN instrument protocol (HiSLIP) is the successor protocol for VXI-11 for TCP-based instruments specified by the IVI Foundation. The protocol uses two
71179.4592.02 ─ 02
Remote control interfaces and protocolsRemote Control via SCPI
LAN interface
TCP sockets for a single connection - one for fast data transfer, the other for non­sequential control commands (e.g. Device Clear or SRQ).
HiSLIP has the following characteristics:
High performance as with raw socket communication
Compatible IEEE 488.2 support for message exchange protocol, device clear, serial poll, remote/local, trigger, and service request
Uses a single IANA registered port (4880), which simplifies the configuration of fire­walls
Supports simultaneous access of multiple users by providing versatile locking mechanisms
Usable for IPv6 or IPv4 networks
Using VXI-11, each operation is blocked until a VXI-11 instrument handshake returns. Using HiSLIP, data is sent to the instrument using the "fire and forget" method with immediate return. Thus, a successful return of a VISA operation such as viWrite() ensure only that the command is delivered to the instrument's TCP/IP buffers. There is no confirmation that the instrument has started or finished the requested command.
For more information, see also the application note:
1MA208: Fast Remote Instrument Control with HiSLIP

2.1.3 Socket communication

An alternative method of remote control of the product is to establish a simple network communication using sockets. The socket communication, also referred to as "Raw Ethernet communication", does not necessarily require a VISA installation on the remote controller side. It is available by default on all operating systems.
The simplest way to establish socket communication is, to use a telnet program. The telnet program is part of every operating system and supports a communication with the software on a command-by-command basis. For more convenience and to enable automation by programs, user-defined sockets can be programmed.
Socket connections are established on a specially defined port. The socket address is a combination of the IP address or the host name of the instrument and the number of the port configured for remote-control. Typically, the products of Rohde & Schwarz use port number 5025 for this purpose. The port is configured for communication on a com­mand-to-command basis and for remote control from a program.

2.1.4 RSIB protocol

The RSIB protocol defined by Rohde & Schwarz uses the TCP/IP protocol for commu­nication with the instrument. Remote control over RSIB is implemented on a message level basis using the SCPI command set of the instrument. The RSIB protocol allows you to control the instrument, for example:
81179.4592.02 ─ 02
Remote control interfaces and protocolsRemote Control via SCPI
LAN interface
Via Visual C++- and Visual Basic programs
Via the Windows applications Word and Excel
Via National Instruments LabView, LabWindows/CVI, Agilent VEE
The control applications run on an external computer in the network.
RSIB interface functions
The RSIB library functions are adapted to the interface functions of National Instru­ments for GPIB programming. The functions supported by the libraries are listed in the following table.
Function Description
RSDLLibfind() Provides means for access to an instrument.
RSDLLibwrt() Sends a zero-terminated string to an instrument.
RSDLLilwrt() Sends a certain number of bytes to an instrument.
RSDLLibwrtf() Sends the contents of a file to an instrument.
RSDLLibrd() Reads data from an instrument into a string.
RSDLLilrd() Reads a certain number of bytes from an instrument.
RSDLLibrdf() Reads data from an instrument into a file.
RSDLLibtmo() Sets timeout for RSIB functions.
RSDLLibsre() Switches an instrument to the local or remote state.
RSDLLibloc() Temporarily switches an instrument to the local state.
RSDLLibeot() Enables/disables the END message for write operations.
RSDLLibrsp() Performs a serial poll and provides the status byte.
RSDLLibonl() Sets the instrument online/offline.
RSDLLTestSrq() Checks whether an instrument has generated an SRQ.
RSDLLWaitSrq() Waits until an instrument generates an SRQ.
RSDLLSwapBytes Swaps the byte sequence for binary numeric display (only required for non-Intel

2.1.5 LXI

LAN extensions for instrumentation (LXI) are an instrumentation platform for measuring instruments and test systems that is based on standard Ethernet technology. LXI is intended to be the LAN-based successor to GPIB, combining the advantages of Ether­net with the simplicity and familiarity of GPIB.
platforms).
The instrument's LXI browser interface works correctly with all W3C compliant brows­ers. Type the instrument's host name or IP address in the address field of the browser to reach its web GUI.
91179.4592.02 ─ 02
The LXI web GUI often includes a SCPI command shell, so that you can send SCPI commands to the instrument via the LXI web GUI in your browser.

2.1.6 LAN interface messages

In the LAN connection, the interface messages are called low-level control messages. These messages can be used to emulate interface messages of the GPIB bus.
Command Long term Effect on the instrument
Remote control interfaces and protocolsRemote Control via SCPI
GPIB interface
&ABO
&DCL
>L
>R
&GET
&LLO
&NREN
&POL
Abort Aborts processing of the received commands.
Device clear Aborts processing of the received commands and sets
the command processing software to a defined initial state. Does not change the instrument setting.
Go to local Transition to the "local" state (manual control). The instru-
ment automatically returns to remote state when a remote command is sent UNLESS &NREN was sent before.
Go to remote Enables automatic transition from local state to remote
state by a subsequent remote command (after &NREN was sent).
Group execute trigger Triggers a previously active instrument function (e.g. a
sweep). The effect of the command is the same as the effect of a pulse at the external trigger signal input.
Local lockout Disables transition from remote control to manual control
via the front panel keys.
Not remote enable Disables automatic transition from local state to remote
state by a subsequent remote command. To reactivate automatic transition, use >R.
Serial poll Starts a serial poll.

2.2 USB interface

For remote control via a USB connection, the PC is connected to the instrument via the USB type B interface of the instrument. A USB connection requires the VISA library to be installed. VISA detects and configures the Rohde & Schwarz instrument automati­cally when the USB connection is established. You do not have to enter an address string or install a separate driver.

2.3 GPIB interface

(IEC 625 / IEEE 418 bus interface)
To be able to control the instrument via the GPIB bus, the instrument and the controller must be linked by a GPIB bus cable. A GPIB bus card, the card drivers and the pro-
101179.4592.02 ─ 02
gram libraries for the programming language used must be provided in the controller. The controller must address the instrument via the GPIB bus address.
Notes and conditions
In connection with the GPIB interface, note the following:
Up to 15 instruments can be connected
The maximum permissible cable length is product-specific.
A wired "OR"-connection is used if several instruments are connected in parallel.
Any connected IEC-bus cables must be terminated by an instrument or controller.

2.3.1 GPIB instrument address

To operate the instrument via remote control, it must be addressed using the GPIB address. For remote control, addresses 0 through 30 are allowed. The GPIB address is maintained after a reset of the instrument settings.
Remote control interfaces and protocolsRemote Control via SCPI
GPIB interface

2.3.2 GPIB interface messages

Interface messages are transmitted to the instrument on the data lines, with the atten­tion line (ATN) being active (LOW). These messages are used for communication between the controller and the instrument and can only be sent by a computer, which has the function of a GPIB bus controller. GPIB interface messages can be further sub­divided into:
Universal commands: act on all instruments connected to the GPIB bus without previous addressing
Addressed commands: only act on instruments previously addressed as listeners
2.3.2.1 Universal commands
Universal commands are encoded in the range 10 through 1F hex. They affect all instruments connected to the bus and do not require addressing.
Command Long term Effect on the instrument
DCL
IFC
Device clear Aborts the processing of the commands received and
Interface clear
*)
sets the command processing software to a defined initial state. Does not change the instrument settings.
Resets the interfaces to the default setting.
LLO
SPE
*) IFC is not a real universal command, it is sent via a separate line; however, it also affects all instruments connected to the bus and does not require addressing
Local lockout The "Local" softkey is disabled. Manual operation is no
longer available until GTL is executed.
Serial poll enable Ready for serial poll.
111179.4592.02 ─ 02
Remote control interfaces and protocolsRemote Control via SCPI
Drivers for graphical programming interfaces
Command Long term Effect on the instrument
SPD
PPU
*) IFC is not a real universal command, it is sent via a separate line; however, it also affects all instruments connected to the bus and does not require addressing
Serial poll disable End of serial poll.
Parallel poll unconfigure End of the parallel-poll state.
2.3.2.2 Addressed commands
Addressed commands are encoded in the range 00 through 0F hex. To send these commands, the GPIB controller must address the instrument (GPIB listeners) via GPIB bus channel.
Command Long term Effect on the instrument
GET
GTL
GTR
REN
PPC
SDC
Group execute trigger Triggers a previously active instrument function (e.g. a
Go to local Transition to the "local" state (manual control).
Go to remote
Remote enable
Parallel poll configure Configures the instrument for parallel poll.
Selected device clear Aborts the processing of the commands received and
sweep). The effect of the command is the same as the effect of a pulse at the external trigger signal input.
Transition to the "remote" state (remote control).
sets the command processing software to a defined initial state. Does not change the instrument setting.

2.4 Drivers for graphical programming interfaces

Many Rohde & Schwarz customers prefer graphical programming interfaces when writ­ing applications for the instruments. Examples for such interfaces are LabVIEW and LabWindows/CVI from National Instruments or VEE from Agilent.
Rohde & Schwarz provides software device drivers free of charge for this purpose. The drivers are available for download from www.rohde-schwarz.com/drivers-vs-plain-scpi.
121179.4592.02 ─ 02
Loading...
+ 26 hidden pages