• General
  • API Documentation
  • SCPI
    • General
    • Command Reference
    • Starting Server

    Show / Hide Table of Contents
    • Setup Connection
    • Usage of NI I/O Trace to monitor the SCPI traffic
    • Command Syntax
    • Status Registering System
    • Synchronization
    • Trigger System
    • Data Formats
    • Data Transmission Formats
    • Measurements
    • Error and Event Types
    • Suffixes
    • List of Abbreviations
    • SCPI Python examples

    Introduction to the SCPI language

    SCPI stands for Standard Commands for Programmable Instruments and it is mainly used for communicating with test and measurement instruments. It is an ASCII language that provides a standardized command set for various functions of measurement devices. It is hierarchically ordered in a tree structure and each measurement device is free to implement certain subsystems.

    The basic syntax is e.g. :SENSe:FREQuency:STARt 10kHz.

    The command set is case-INsensitive. For each command exists a short and a long version. In the example above :SENS:FREQ:STAR 10kHz would be the short version and :SENSE:FREQUENCY:START 10kHz would be the long version. In each hierarchy level the short OR the long version can be used, but everything in between is not valid (e.g. :SENS:FREQuency:STAR 10kHz is valid but :SENS:FREQuen:STAR 10kHz is not valid because FREQuen is neither the short nor the long version).

    Special characters

    There are various special characters that can be used in SCPI commands.

    character meaning usage
    : separates different hierarchy levels and is used to navigate through subsystems :level1:level2:level3:cmd
    ? signalizes that the command is a query and therefore expects a return value :SENS:FREQ:STAR? - gets the start frequency
    , separates multiple parameters :cmd parameter1,parameter2
    ; separates compound commands without changing the hierarchy level level:sublevel:firstCmd;stillSubLevel:secCmd
    {} lists all possible options that are accepted { OPTion1 | OPTion2 | OPTion3 }
    [] indicates an optional entry that can be added but is not needed :main[:optionalLevel]:command

    Hierarchy Levels

    Optional hierarchy levels

    If a hierarchy level is enclosed in square brackets it is optional. That means it can be written but it can also be omitted. E.g. in the query :STATus:OPERation[:EVENt]? both the queries :STATus:OPERation? and :STATus:OPERation:EVENt? are valid and return the same value.

    Compound commands

    Multiple commands can be combined into a single compound command. The individual commands are split by a semicolon ;. The semicolon does NOT reset the hierarchy level. That enables easier combination of multiple commands to the same subset.

    E.g. if you want to set the start and the stop frequency of a sweep it is possible to combine the two commands :SENS:FREQ:STAR 500kHz and :SENS:FREQ:STOP 900kHz into a single compound command :SENS:FREQ:STAR 500kHz;STOP 900kHz.

    If the hierarchy level should be reset, add a colon : as a prefix to the command. This resets the hierarchy level and starts again at the root level. In single commands the colon can be omitted because it always starts at the root level.

    E.g. :SENS:FREQ:STAR 500kHz;:SENS:FREQ:STOP 900kHz

    Parameter separation

    The first whitespace is used to separate the command and the parameters. Each following whitespace is ignored. When using multiple parameters, the individual parameters are separated by a comma ,.

    If more (or less) parameters than needed are added to a command, an error (either -108, Parameter not allowed or -109, Parameter missing ) is generated and the command is NOT executed.

    Most queries do not need parameters. If a parameter is added to a query that does not expect a parameter an error (-108, Parameter not allowed) is generated. The expected return value is returned nonetheless, so that the end user gets to see the error message. Otherwise the program could block the execution because a return value as expected and none is received. It is considered to always check the error messages.

    Back to top Generated by DocFX