SCPI Explained - SCPI Commands
Command Structure
SCPI commands follow a tree-like structure. Related commands are grouped into branches of the tree. Each keyword in the command is called a node. The first node is called the root node.
Take a look at this diagram:
This shows a small section of the SCPI command set for a DMM. Commands are formed by traversing the tree downwards, placing colon (:) delimiters between nodes, e.g. the following are all legal SCPI commands from the tree shown:
MEASure:VOLTage:DC?
MEASure:VOLTage:DC:RATio?
MEASure:CURRent:AC?
Since a table would take up too much space in a user manual, SCPI commands are listed in a textual format. The tree shown translates as:
MEASure:
VOLTage:DC?
VOLTage:DC:RATio?
VOLTage:AC?
CURRent:DC?
CURRent:AC?
NOTE: Uppercase letters indicate the short-form of the keywords - e.g. MEAS:VOLT:DC? is the short-form of the command. Lowercase letters indicate the long-form of the keywords, e.g. MEASURE:VOLTAGE:DC? Note, commands can be entered in either upper or lowercase or a mixture of the two (SCPI parsers must be case-insensitive) - uppercase and lowercase are only used when documenting the commands.
Compound Commands
A user can enter more than one SCPI command on the same command line. This is done by entering the commands separated by a semi-colon (;). For example:
MEASURE:VOLTAGE:DC?;DC:RATIO?
This is equivalent to the following two commands:
MEASURE:VOLTAGE:DC?
MEASURE:VOLTAGE:DC:RATIO?
A feature of compound commands is that the following command starts at the last node of the previous command. This often makes the command line shorter than it would be otherwise. But what if you want a to use a command on a different branch?
If this is the case, you must put a colon (:) before the command that follows the semi-colon (;). This returns the command tree to the root. For example this is a valid command line:
MEASURE:VOLTAGE:DC?;:MEASURE:CURRENT:DC?
Other Features of SCPI Commands
SCPI Commands can include other features such as default nodes and optional keywords. In addition we have not yet discussed command parameters. SCPI supports many parameter types, including numeric values, strings, Booleans etc. Parameters can be optional, or different types of parameter can be acceptable for the same command. Numeric values may be specified in scientific notation (e.g. 1.5e+12).
All these features of SCPI are handled by JPA-SCPI Parser.
Further Information
This has been a very brief introduction to SCPI. For more information, see our links. You may also want to refer to the SCPI Standard document, available from our website.
Read on