0% found this document useful (0 votes)
18 views

Introduction To SCPI Language

Uploaded by

bulkas681
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

Introduction To SCPI Language

Uploaded by

bulkas681
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

09.05.

2024, 19:07 Introduction to SCPI Language

Introduction to the SCPI Language


SCPI (Standard Commands for Programmable Instruments) is an ASCII-based instrument command language
designed for test and measurement instruments. SCPI commands are based on a hierarchical structure, also known
as a tree system. In this system, associated commands are grouped together under a common node or root, thus
forming subsystems. A portion of the OUTPut subsystem is shown below to illustrate the tree system.

OUTPut:
SYNC {OFF|0|ON|1}

SYNC:
MODE {NORMal|CARRier}
POLarity {NORMal|INVerted}

OUTPut is the root keyword, SYNC is a second-level keyword, and MODE and POLarity are third-level keywords.
A colon ( : ) separates a command keyword from a lower-level keyword.

Syntax Conventions
The format used to show commands is illustrated below:

[SOURce[1|2]:]VOLTage:UNIT {VPP|VRMS|DBM}

[SOURce[1|2]:]FREQuency:CENTer {<frequency>|MINimum|MAXimum|DEFault}

The command syntax shows most commands (and some parameters) as a mixture of upper- and lower-case
letters. The upper-case letters indicate the abbreviated spelling for the command. For shorter program lines, you
can send the abbreviated form. For better program readability, you can send the long form.

For example, in the above syntax statement, VOLT and VOLTAGE are both acceptable forms. You can use upper- or
lower-case letters. Therefore, VOLTAGE, volt, and Volt are all acceptable. Other forms, such as VOL and VOLTAG,
are not valid and will generate an error.

Braces ( { } ) enclose the parameter choices for a given command string. The braces are not sent with
the command string.

A vertical bar ( | ) separates multiple parameter choices for a given command string. For example,
{VPP|VRMS|DBM} in the above command indicates that you can specify "VPP", "VRMS", or "DBM". The
bar is not sent with the command string.

Triangle brackets in the second example ( < > ) indicate that you must specify a value for the enclosed
parameter. For example, the above syntax statement shows the <frequency> parameter enclosed in
triangle brackets. The brackets are not sent with the command string. You must specify a value for the
parameter (for example "FREQ:CENT 1000") unless you select another option shown in the syntax (for
example "FREQ:CENT MIN").

Some syntax elements (for example nodes and parameters) are enclosed in square brackets ( [ ]). This
indicates that the element is optional and can be omitted. The brackets are not sent with the command
string. If you do not specify a value for an optional parameter, the instrument chooses a default value.
In the examples above the "SOURce[1|2]" indicates that you may refer to source channel 1 either by
"SOURce", or by "SOURce1", or by "SOUR1" or by "SOUR". In addition, since the whole SOURce node is
optional (in brackets) you also may refer to channel 1 by entirely leaving out the SOURce node. This is
because Channel 1 is the default channel for the SOURce language node. On the other hand, to refer to
Channel 2, you must use either "SOURce2" or "SOUR2" in your program lines.

Command Separators
A colon ( : ) is used to separate a command keyword from a lower-level keyword. You must insert a blank space to
separate a parameter from a command keyword. If a command requires more than one parameter, you must
separate adjacent parameters using a comma as shown below:

APPL:SIN 455E3,1.15,0.0

In this example, the APPLy command is specifying a sine wave at a frequency of 455 KHz, with an amplitude of
1.15 volts, and a DC offset of 0.0 volts.

A semicolon ( ; ) is used to separate commands within the same subsystem, and can also minimize typing. For
example, sending the following command string:

https://rfmw.em.keysight.com/spdhelpfiles/33500/webhelp/us/content/__I_SCPI/00 scpi_introduction.htm 1/4


09.05.2024, 19:07 Introduction to SCPI Language

TRIG:SOUR EXT; COUNT 10

is the same as sending the following two commands:

TRIG:SOUR EXT
TRIG:COUNT 10

Using the MIN, MAX, and DEF Parameters


For many commands, you can substitute "MIN" or "MAX" in place of a parameter. In some cases you may also
substitute "DEF". For example, consider the following command:

[SOURce[1|2]:]APPLy:DC [{<frequency>|DEF} [,{<amplitude>|DEF} [,{<offset>|MIN|MAX|DEF}]]]

Instead of selecting a specific value for the <offset> parameter, you can substitute MIN to set the offset to its
minimum value, MAX to set the offset to its maximum value. You can also specify DEF to set the default value for
each parameter: <frequency>, <amplitude>, and <offset>.

Querying Parameter Settings


You can query the current value of most parameters by adding a question mark ( ? ) to the command. For
example, the following command sets the trigger count to 10 readings:

TRIG:COUN 10

You can then query the count value by sending:

TRIG:COUN?

You can also query the minimum or maximum count allowed as follows:

TRIG:COUN? MIN
TRIG:COUN? MAX

SCPI Command Terminators


A command string sent to the instrument must terminate with a <new line> (<NL>) character. The IEEE-488 EOI
(End-Or-Identify) message is interpreted as a <NL> character and can be used to terminate a command string in
place of a <NL> character. A <carriage return> followed by a <NL> is also accepted. Command string termination
will always reset the current SCPI command path to the root level.

For every SCPI message that includes a query and is sent to the instrument, the instrument
terminates the returned response with a <NL> or line-feed character (EOI). For example, if
"DISP:TEXT?" is sent, the response is terminated with a <NL> after the string of data that is
returned. If a SCPI message includes multiple queries separated by semicolons (for example
"DISP?;DISP:TEXT?"), the returned response is again terminated by a <NL> after the response
to the last query. In either case, the program must read this <NL> in the response before
another command is sent to the instrument, or an error will occur.

IEEE-488.2 Common Commands


The IEEE-488.2 standard defines a set of common commands that perform functions such as reset, self-test, and
status operations. Common commands always begin with an asterisk ( * ), are three characters in length, and may
include one or more parameters. The command keyword is separated from the first parameter by a blank space.
Use a semicolon ( ; ) to separate multiple commands as shown below:

*RST; *CLS; *ESE 32; *OPC?

SCPI Parameter Types


The SCPI language defines several data formats to be used in program messages and response messages.

https://rfmw.em.keysight.com/spdhelpfiles/33500/webhelp/us/content/__I_SCPI/00 scpi_introduction.htm 2/4


09.05.2024, 19:07 Introduction to SCPI Language
Numeric Parameters

Commands that require numeric parameters will accept all commonly used decimal representations of numbers
including optional signs, decimal points, and scientific notation. Special values for numeric parameters such as MIN,
MAX, and DEF are also accepted. You can also send engineering unit suffixes with numeric parameters (e.g., M, k,
m, or u). If a command accepts only certain specific values, the instrument will automatically round the input
numeric parameters to the accepted values. The following command requires a numeric parameter for the
frequency value:

[SOURce[1|2]:]FREQuency:CENTer {<frequency>|MINimum|MAXimum}

Because the SCPI parser is case-insensitive, there is some confusion over the letter "M" (or "m").
For your convenience, the instrument interprets "mV" (or "MV") as millivolts, but "MHZ" (or
"mhz") as megahertz. Likewise "MΩ" (or "mΩ") is interpreted as megohms. You can use the
prefix "MA" for mega. For example, "MAV" is interpreted as megavolts.

Discrete Parameters

Discrete parameters are used to program settings that have a limited number of values (like IMMediate, EXTernal,
or BUS). They may have a short form and a long form just like command keywords. You can mix upper- and lower-
case letters. Query responses will always return the short form in all upper-case letters. The following command
requires a discrete parameter for the voltage units:

[SOURce[1|2]:]VOLTage:UNIT {VPP|VRMS|DBM}

Boolean Parameters

Boolean parameters represent a single binary condition that is either true or false. For a false condition, the
instrument will accept "OFF" or "0". For a true condition, the instrument will accept "ON" or "1". When you query a
Boolean setting, the instrument will always return "0" or "1". The following command requires a Boolean
parameter:

DISPlay {OFF|0|ON|1}

ASCII String Parameters

String parameters can contain virtually any set of ASCII characters. A string must begin and end with matching
quotes; either with a single quote or a double quote. You can include the quote delimiter as part of the string by
typing it twice without any characters in between. The following command uses a string parameter:

DISPlay:TEXT <quoted string>

For example, the following command displays the message "WAITING..." on the instrument's front panel (the
quotes are not displayed).

DISP:TEXT "WAITING..."

You can also display the same message using single quotes.

DISP:TEXT 'WAITING...'

https://rfmw.em.keysight.com/spdhelpfiles/33500/webhelp/us/content/__I_SCPI/00 scpi_introduction.htm 3/4


09.05.2024, 19:07 Introduction to SCPI Language

Using Device Clear


Device Clear is an IEEE-488 low-level bus message that you can use to return the instrument to a responsive state.
Different programming languages and IEEE-488 interface cards provide access to this capability through their own
unique commands. The status registers, the error queue, and all configuration states are left unchanged when
a Device Clear message is received.

Device Clear performs the following actions:

If a measurement is in progress, it is aborted.

The instrument returns to the trigger "idle" state.

The instrument's input and output buffers are cleared.

The instrument is prepared to accept a new command string.

The ABORt command is the recommended method to terminate an instrument operation.

https://rfmw.em.keysight.com/spdhelpfiles/33500/webhelp/us/content/__I_SCPI/00 scpi_introduction.htm 4/4

You might also like