SCPI Basics
SCPI Basics
The Standard Commands for Programmable Instrumentation (SCPI; often pronounced "skippy"), define syntax and structure rules to use and create commands for programmable instrumentation like measurement instruments.
SCPI Overview
The eLABin1 contains an expanded subset of the SCPI-commands which have been defined as an additional layer on top of the IEEE 488.2-1987 specification "Standard Codes, Formats, Protocols, and Common Commands".[3] The standard specifies a common syntax, command structure, and data formats, to be used with all instruments.
The physical hardware communications link is not defined by SCPI. While it was originally created for the IEEE-488.1 (GPIB) bus, SCPI can also be used with RS-232, RS-422, Ethernet, USB, VXIbus, HiSLIP, etc. The eLABin1 implementation alows communication via USB, Ethernet and WiFi.
SCPI commands are ASCII textual strings, which are sent to the instrument over the physical layer (e.g., IEEE-488.1). Commands are a series of one or more keywords, many of which take parameters.
Responses to query commands are typically ASCII strings. However, for bulk data, binary formats can be used.
SCPI Command Syntax
SCPI commands to an instrument may either perform a set operation (e.g. switching a power supply on) or a query operation (e.g. reading a voltage).
Queries are issued to an instrument by appending a question-mark to the end of a command. Some commands can be used for both setting and querying an instrument.
Command Types
Configuration commands | are commands used to adjust subsystem values within the eLABin1. For example: AWG:C1:FREQ 200Khz | ||
---|---|---|---|
Query commands | are commands through which eLABin1 is “asked” for the current status of a subsystem. For example: AWG:C1:FREQ? | ||
Common commands | are commands used to manage macros, states, registers, synchronization and data storage, and are defined by IEEE 488:2. For example: *IDN? |
Command Structure
In some mnemonics such as 'FREQuency' the lowercase letters indicate that the eLABin1 recognizes the mnemonics in the two forms, either with its short form in uppercase ('FREQ') or in the long form with uppercase and the rest of its name in lowercase ('FREQency'), the commands that allow these two types of syntax are explained later in the command tables for each instrument. Commands that appear in the tables with upper and lower case are recognized either with its short form in uppercase and in the long form with uppercase and the rest of its name in lowercase. Ff the mnemonic only appears in uppercase indicates that eLABin1 only accepts the short form in uppercase.
The syntax for the query commands only changes its structure in that the argument is replaced by a question mark to ask for the configured value in a certain subsystem of the instrument, as shown in the following example:
The command OSC:TROF?
asks the eLabin1 oscilloscope for the Offset
value of the trigger, to which the oscilloscope will give an answer with
OSC:TROF 200mV
following the same syntax used by the
configuration commands.
The syntax for common commands follows a basic structure consisting of an asterisk (*) at the beginning of the command, followed by the statement that has a question mark at the end (?) Depending on whether it is a query command or not, one or two examples are shown, one with a query command and another with a configuration command:
*IDN?
: asks the instrument for its identification.
*RST
: resets the instrument to the default values.
Command Tree
The SCPI standard uses a tree structure, made up by subsystems for command creation, this command structure is called the command tree and an example is shown in Figure 2.
Figure 2 displays the tree structure
for AM and FM modulated wave subsystem commands for the eLABin1 AWG. As an example
you can see the hierarchical structure that follows the command
AWG:C2:MDWV:AM:FREQ <number><unit>