ML2439A USB Power Meter User Guide : SCPI Commands : SCPI Language
 
SCPI Language
ML2439A instruments may be remotely controlled using commands that follow the industry standard SCPI programming conventions.
SCPI Structure
The SCPI instrument model defines a hierarchical command structure based on “command nodes”. Each node may contain commands or names of a next-level command node. Each command is formed of a series of keywords joined together and delimited by a colon “:” character. The command begins with a colon at the “root node”, and traverses downwards through the command tree to form a specific command. This structure is very similar to a DOS file system, where the file system begins at the root level (“:”), and each directory (SCPI subsystem) may contain a list of files (SCPI commands) and lower- level directories. To execute an individual command, the entire command name (“path”) must generally be specified, although there are several shortcuts available to reduce the command string length.
SCPI subsystems or command groups are usually aligned with instrument functions, and the standard provides a number of pre-defined subsystems that can be used for most instrument types. For example, the top-level SENSe subsystem groups commands that are related to sensing signals (detection, amplification, digitization, linearization), while the OUTPut subsystem contains commands that control output functions of the instrument such as voltage output or controlling an RF reference output.
5-4 ML2439A Native Commands
This section provides an alphabetical listing of the GPIB commands (mnemonics) used to program the Model ML2439A Power Meter in ML2439A (native) mode. The emulation mode can be set through the front panel SYSTEM > more > more > Rear panel > GPIB > MODE menu or through the GPIB command EMUL.
All ML2439A (native) GPIB commands that use parameters must have a space between the command header and the first parameter, and all subsequent parameters must be separated by a comma (,). Multiple commands may be sent on the same line, but must be separated by a semicolon (;).
The format for ML2439A (native) GPIB commands is:
<command header><space><parameter 1>,<parameter n>,...
The end of the command text must be terminated with a line feed character (0Ah, decimal 10) or a GPIB End of Transmission State (EOI), or both.
Long and Short Form Keywords
Each command or subsystem may be represented by either its full keyword, or a short form of that keyword. The short form is typically the first several characters of the full name, although this is not necessarily the case. The short form of each keyword is identified in this manual by the keyword characters shown in UPPERCASE, while the long form will be shown in mixed case. For example, the short form of “CALCulate” is “calc”, while the long form is “calculate”. Long form and short form commands may be used interchangeably, but only the exact forms are permitted – intermediate length commands will not be recognized. Sending “CALCUL” will cause an error.
Note that not all keywords have long forms – in this case, the entire keyword will be shown in uppercase.
While uppercase and lowercase text is used to identify keywords, SCPI is generally case-insensitive, so it is acceptable to send uppercase, lowercase, or mixed case keywords to the instrument. The only exception is when a command accepts a literal string argument. In this case, quotes may be used to delimit a string of user-defined case.
Subsystem Numeric Suffixes
Certain subsystems, such as the SENSe or CALCulate subsystems in the ML2439A, often exist as more than one instance (often called a “channel” in an instrument). In this case, an optional numeric suffix may be used to define the channel. If this suffix is not present, the default channel is assumed. For example, SENSe or SENSe1 defines operations affecting the instrument’s “Channel 1” measurement path, while SENSe2 commands will apply to channel 2.
Colon Keyword Separators
The colon (“:”) character is used similar to the way a slash or backslash is used in a filesystem. Prefixing a command string with a colon is optional and is ignored by the ML2439A.
Command Arguments and Queries
Many commands require arguments. In this case, the entire command string is sent, followed by the argument. A space is used to separate the command from the argument. For example, “SENSe:CORRection:DCYCle 25.0” sets duty cycle correction to a value of 25.0. Arguments may be numeric, or alphanumeric. If a command requires more than one numeric argument, the arguments must be sent as a comma delimited list.
To read the current value of a particular parameter, the Query Form of its command may be used. A command query is formed by appending a question-mark (“?”) suffix to the command instead of an argument list. There should not be any whitespace between the command and the suffix. For example, “SENSe:CORRection:DCYCle?” queries the duty cycle correction parameter, and causes the instrument to return its current value.
 
ML2439A SCPI Implementation
The SCPI implementation for the ML2439A provides a single or dual SENSe sub-system to handle sensor input and a matching single or dual CALCulate sub-system to process the data obtained from the sensors into useful results. A TRIGger sub-system provides for measurement and signal synchronization. DISPlay commands are used for graph and text display control, formatting and timebase selection. The CALibration sub-system is used to calibrate power sensors. Channel dependent commands end with a number to indicate the desired channel as follows:
Examples:
:CALCulate:STATe ON
Turn on measurement channel 1 (default channel number)
:CALCulate1:STATe ON
Turn on measurement channel 1 (specified channel number)
:CALC:STAT ON
Turn on measurement channel 1 (short form, default chan #)
:CALC1:STAT ON
Turn on measurement channel 1 (short form, specified chan #)
:CALCulate:STATe?
Query the state of measurement channel 1 (default chan #)
:CALC:STAT?
Query the state of channel 1 (short form, default chan #)
:CALCulate1:STATe?
Query the state of measurement channel 1 (specified chan #)
:CALC1:STAT?
Query the state of channel 1 (short form, specified chan #)
:DISPlay:PULSe:TIMEBASE 0.0001
Set timebase range to 100 us/Div (time in seconds)
:DISP:PULS:TIMEBASE 100 us
Set timebase range to 100 us/Div (short form with time units)
:SENSe:CORRection:OFF Set 0.42
Set channel 1 offset correction to 0.42 dB (chan units dBm)
:TRIGger:LEVel –3.12
Set trigger level to –3.12 dBm (trig units dBm)
:SENS:CORR:OFF 0.42; :TRIG:LEV –3.12
Concatenated commands using semi-colon (short form)
In the discussion and tables below, the following notation will be used:
Command name long and short form:
SYSTem
Optional command name in brackets:
SYSTem:ERRor[:NEXT]?
Command with channel dependence:
CALCulate[1|2]:STATe OFF Default channel 1: CALCulate:STATe OFF
Explicit channel 1:
CALCulate1:STATe OFF
Select channel 2:
CALCulate2:STATe OFF
Short Form:
CALC2:STAT OFF
Command which takes numeric argument:
SENSe1:AVERage <numeric_value> Same command; query: SENSe1:AVERage?
Command with literal text argument:
TRIGger:SOURce <character data> Command with no query form: *CLS
Command with query form only:
SENSe:SENSOR:TYPE?
Syntax Notes
Square brackets [ ] are used to enclose the list of valid channels for a command, or a list of command options separated by the vertical separator bar | character. This character is for syntax only, and is not to be entered as part of the command. By default, if no channel number is specified, Channel 1 is selected.
A literal argument denoted by <character data> indicates a word or series of characters, which must exactly match one of the choices for the command. An argument denoted by <numeric_value> requires a string which, when converted to a number, is within the range of valid arguments. Numerical values can generally be in any common form including decimal and scientific notation. <Boolean> indicates an argument which must be either true or false. Boolean arguments are represented by the values 0 or OFF for false, and 1 or ON for true. Queries of Boolean parameters always return 0 or 1.
Curly braces { } are used to enclose two or more possible choices for a mandatory entry, separated by the comma character. One of the enclosed options MUST be inserted into the command, and the braces are not to be entered as part of the command.
IEEE 488.2 Commands
The purpose of IEEE488.2 commands is to provide management and data communication instructions for the system by defining a set of “*” commands (an asterisk followed by a three-character code). These commands provide device control and monitoring.
*IDN?
Description:
Return the instrument identification string. This string contains the manufacturer, model number, serial number and firmware version number.
Syntax:
*IDN?
Returns:
< Mfgr, Model#, Serial#, Version# >
Valid Modes:
Any
 
*OPC
Description:
Clears the OPC (Operation Complete) status flag. This command is issued before the command to be checked for completion. After this, the flag may be queried by *OPC? until a value of one is returned, indicating the command has completed. Note that the query is not a true query - a value of zero will never be returned.
Syntax:
*OPC
Argument:
None
Valid Modes:
Any
 
*OPC?
Description:
This command examines the OPC (Operation Complete) status flag and returns a ”1” if all pending operations are complete. If pending operations are not yet complete, it does not return.
Syntax:
*OPC?
Returns:
Always returns 1 to indicate operations complete. Otherwise, does not return.
Valid Modes:
Any
 
*TST?
Description:
Self-test query. This command initiates a self-test of the instrument and returns a result code when complete. The result is zero for no errors, or a signed, 16-bit number if any errors are detected.
Syntax:
*TST
Returns:
Error Code
Valid Modes:
Any
 
*WAI
Description:
Wait command. This command insures sequential, non-overlapped execution. The ML2439A always operates in non-overlapped, sequential mode, therefore this command is accepted as valid, but takes no action.
Syntax:
*WAI
Argument:
None
Valid Modes:
Any