1. What is SCPI?
SCPI (Standard Commands for Programmable Instruments) is a standardized set of text-based commands used to remotely control programmable test and measurement instruments. It defines the syntax and semantics that a controller must use to communicate with the instrument. This manual is an overview of SCPI and shows how SCPI is used in Pendulum CNT-104S instrument. SCPI is based on IEEE-488.2 to which it owes much of its structure and syntax.
2. Syntax and Style
2.1. Syntax of Program Messages
Syntax of Program Messages
In SCPI all messages that you can send to an instrument are divided into two categories: commands (that do not imply getting any response) and queries (that allow to get response back from the instrument). Queries have question mark (‘?’) at the end of command header.
A command or query is called a program message unit. A program message unit consists of a header followed by zero or more parameters:
<header> [parameter [,parameter ,...]]
For example, in the query
FETCH:ARRAY? MAX, A
FETCH:ARRAY
is a header and MAX
and A
are parameters.
One or more program message units (commands) may be sent within a simple program message:
<program message unit>; <program message unit>; <program message unit>...
For example,
:INIT; *OPC?
2.2. Common Commands
Common Commands
SCPI standard defines a set of commands that every instrument must support. The common command header starts with the asterisk character (*), for example *RST
.
2.3. SCPI Commands Tree
SCPI Commands
SCPI command headers may consist of several keywords (mnemonics), separated by the colon character (:).
Each keyword in a SCPI command header represents a node in the SCPI command tree. The leftmost keyword is the root level keyword, representing the highest hierarchical level in the command tree.
The keywords following represent subnodes under the root node.
Example: :SYST:CONF "Sample Interval=15ms"
In this example first colon (:) referers to the root of the tree. Next, SYST refers to an item under root, and CONF referes to an item under SYST.
2.4. SCPI commands syntax description used in this manual
2.4.1. Short and long forms
According to SCPI each command header can have short and long form. In order to distinguish both forms in command syntax description, upper and lower case characters are used. Note, that SCPI is case-insensitive, the usage of upper and lower case characters is done solely for the purpose of syntax definition. You may even mix upper and lower case. There is no semantic difference between upper and lower case in program messages. Same applies for parameters – they may have short and long forms.
Example 1. Let’s consider such syntax description: SYSTem:CONFigure <parameters>
Here SYST
and CONF
specify the short form, and SYSTem
and CONFigure
specify the long form. It means that the instrument will accept the following command headers: syst:conf
, SYST:CONF
, SYSTEM:CONFIGURE
, SYST:CONFIGURE
, or even sYstEm:cOnFiGuRE
. However, SYSTE
or CONFIG
headers are not allowed and will cause a command error, because they don’t refer to short or long forms.
Example 2. Let’s consider such syntax description :FORMat[:DATA] <format>
, where <format>
is one of ASCii
, REAL
or PACKed
. Such argument syntax indicates that the argument may be specified as: ASCII, ASC, asc, REAL, real, PACKED, pack, PACK.
2.4.2. Default nodes and arguments
SCPI standard states that some nodes in SCPI commands tree may play role of default nodes. That means that it is not required to specify them in command headers. Same applies for arguments. In this manual optional nodes and arguments are denoted with square brackets.
For example, let’s consider the following syntax description: :FETCh[:SCALar]? [<series name>]
Here square brackets indicate the fact that the node inside them (SCALAR) is default node under its parent node (FETCH). That means that you can specify the header as: :FETCH
or :FETCH:SCALAR
and result will be same. Same applies for parameters in square brackets. In this syntax <series name>
parameter is marked as optional. Exact behavior of a command with omitted parameter is specified separately for each command.
2.5. Parameters
Each command defines which type of parameters it accepts.
2.5.1. Numeric Data
- Decimal data. Numeric values that may contain both a decimal point and an exponent (base 10). Examples: 2.5, 1e-10, 5
- Integer. Integer numbers.
2.5.2. Keywords
In addition to entering decimal data as numeric values, several keywords can exist. The manual explicitly specify which keywords are allowed by a particular command.
2.5.3. Boolean Data
A Boolean parameter specifies a single binary condition which is either true or false.
Boolean parameters can be one of the following:
- ON or 1 means condition true.
- OFF or 0 means condition false.
2.5.4. Other Data Types
- String data. Always enclosed between single or double quotes, for example “This is a string” or ‘This is a string.’
- Non-decimal data: For instance, #H3A for hexadecimal data.
- Block data: Used to transfer any 8-bit coded data. This data starts with a preamble that contains information about the length of the parameter.