- overview of the SCPI, Standard Commands for Programmable Instrumentation command set, structure and notation.
SCPI commands enable an instrument to perform operations.
The SCPI commands are organised in a logical fashion to allow easy programming and operation.
The SCPI commands allow the instrument to be prepared for making a measurement and also for taking particular measurement itself. As there are many different types of instrument from many different manufacturers, the SCPI commands need to accommodate a very wide variety of instrument types, commands and general requirements.
SCPI command types
There are two main types of command within the SCPI command structure:
- Common commands: Common SCPI commands are device-independent commands used within the overall structure to provide commands that may be understood by all forms of instrument. These commands consist of a header preceded by an asterisk "*" and possibly one or more parameters.
RST RESET This resets the instrument. ESR? EVENT STATUS QUERY, queries the contents of the event status register.
- Instrument control commands: Instrument-control commands are based on a hierarchical structure and can be represented in a command tree. The command headers are built with one or several mnemonics (keywords). The first level (root level) mnemonic identifies a complete command system. An example may be SENSe This mnemonic identifies the command system SENSe.
Within the SCPI control command set, there are two types of command that may be issued:
- Set operation: A set operation commands the instrument to be set in a particular way. For example it could request a power supply to be set to a given voltage, current limit, etc..
- Query operation: A query operation issues a command to the instrument to respond with a reading. Query operations are terminated with a question mark: "?".
SCPI command structure
The SCPI command structure is organised to give a tree-like topology with branches flowing out from a central trunk or source area. The related SCPI commands are grouped into branches.
Each keyword in the command is called a node. The first node is called the root node. As shown below.
The tree diagram gives a good graphic visualisation of the SCPI command structure, however the SCPI commands themselves are written in a textual manner. They can be created by moving from the root node downwards. Colons ":" are then placed between the different nodes as shown below:
It can be seen from the SCPI command above that the text consists of a mixture of upper and lower case. Although SCPI parsers are case insensitive and the commands could be entered in either, the uppercase letters indicate the short-form version of the commands that could be used if required. As a result the short-form instruction below would be equally applicable:
Compound SCPI commands
It is possible to place multiple commands on the same command line. This can save space and also group commands together.
Compound commands are created by entering he commands separated by a semi-colon ";".
This would be the same as the following two SCPI commands:
When using compound SCPI commands, care has to be taken over the node structure because any subsequent commands commence at the last node of the previous command. This has the advantage of making command lines shorter, but where commands on different branches need to be used, the command structure changes slightly. To accommodate this, a colon ":" is used before the semi-colon command separator. This returns the system to the command tree root node.
By Ian Poole
Share this page
Want more like this? Register for our newsletter