Introduction To SCPI Language
Introduction To SCPI Language
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:
TRIG:SOUR EXT
TRIG:COUNT 10
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>.
TRIG:COUN 10
TRIG:COUN?
You can also query the minimum or maximum count allowed as follows:
TRIG:COUN? MIN
TRIG:COUN? MAX
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.
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}
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:
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...'