SCPI Commands

- overview of the SCPI, Standard Commands for Programmable Instrumentation command set, structure and notation.

In this section

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.

      Examples:
    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: "?".
    Some instrument commands can act as a set and query operation. One example may be a CAL? command which could initiate a self-calibration routine and then return the results of the calibration, although this would be instrument dependent..

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.

SCPI commands structure

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:

        MEASure:VOLTage:DC?

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:

        MEAS:VOLT:DC?


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 ";".

        MEASure:CURRent:DC?;DC:RATio?

This would be the same as the following two SCPI commands:

        MEASure:CURRent:DC?

        MEASure:CURRent:DC:RATIO?

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.

        MEASure:CURRent:DC?;:MEASure:VOLTage:DC?

By Ian Poole


<< Previous   |   Next >>


Share this page


Want more like this? Register for our newsletter









What to consider when incorporating an intelligent touch screen display into your product Markku Rihonnen | 4D Systems
What to consider when incorporating an intelligent touch screen display into your product
Gone are the days of rotary switches, push buttons and seven segment displays. Incorporating touch screen displays into embedded designs is the trend, accelerated of course by consumer adoption of the smartphone.









Radio-Electronics.com is operated and owned by Adrio Communications Ltd and edited by Ian Poole. All information is © Adrio Communications Ltd and may not be copied except for individual personal use. This includes copying material in whatever form into website pages. While every effort is made to ensure the accuracy of the information on Radio-Electronics.com, no liability is accepted for any consequences of using it. This site uses cookies. By using this site, these terms including the use of cookies are accepted. More explanation can be found in our Privacy Policy