SCPI, A Programming Language for Measurement Device

FILPAL
4 min readJun 27, 2021

Standard Commands for Programming Instruments, also known as SCPI is a standard for syntax and commands designed specifically for controlling instruments. It consists of generic commands that could be used with any instruments including network analyzer, spectrum analyzer ,digital multimeter and more. SCPI commands are written in ASCII strings, which are sent to instrument over physical communication layer.

Origin of SCPI

In 1975, IEEE introduced Standard Digital Interface for Programmable Instrumentation, IEEE-488. Later, the revised versions are introduced as IEEE-488.1. It specified the physical and electrical bus, and IEEE-488.2 specified protocol and data format. However, IEEE-488 still lack universal commands to control instruments of the same class by different manufacturers.

Hewlett-Packard (HP) which is famous by their laptops nowadays, recognized this limitation and started to develop their TML language in 1989 which became the forerunner to SCPI. In 1990, SCPI was finally created as a standard which could be commonly used by all manufacturers and models of any instrument.

SCPI Consortium would later vote to become part of the IVI Foundation (Interchangeable Virtual Instruments). Even until today, IVI foundation is still the maintainer for Virtual Instrument Software Architecture (VISA) which is one of the API for SCPI.

SCPI Syntax and Commands

SCPI commands can perform two types of operations, namely set operation and query operation. Set operation send commands to instruments without expecting a return (e.g. set the frequency range of the network analyzer). On the other hand, query operation can prompt the instruments to return results (e.g. reading a current of digital multimeter).

Some commands can be used for both setting and querying an instrument. Take “ SENSe:FREQuency:STARt” as an example, by adding a question-mark at the end of command (e.g. “ SENSe:FREQuency:STARt?”), the command acts as a query operation and return the current start frequency display on the network analyzer; On the other side, adding the values at the end of commands (e.g. “ SENSe:FREQuency:STARt 1000000000 “) will set the start frequency of network analyzer as 1GHz.

As shown in the paragraph above, commands are a series of one or more keywords. Similar commands are grouped into a tree structure. For example, instructions that are related to system setting of the instrument will begin with “ SYSTem”. The sub-commands within the hierarchy can be “ PRESet” to reset the setting or “ ERRor “ to return the error messages from instruments.

At this point, you might notice the SCPI command syntax is a mixture of upper and lower case. Sending the full commands with upper and lower case is same as sending the upper-case syntax only. For example, the command “ INITiate.CONTinuous 0” which to hold the signal is same as “ INIT.CONT 0 “.

SCPI Connection

The connection between programmed SCPI commands and instruments requires application programming interface (API). The common APIs for SCPI are VISA and socket network. While API handle the connection to pass the SCPI commands to the instruments, the programming language such as C# and python is handling the logic of the workflow.

The physical connection of instrument and computer can be either of GPIB, ethernet and USB interfaces.

Troublesome Steps in Measurement

The measurement process of multiple device under test (DUT) using an instrument is a repetitive work which requires users to keep pressing different buttons on the instrument. Furthermore, the action of exporting the data and viewing the exported data is also time consuming because it requires user to save the result of the instruments into an external drive before copying to a device that consist of the viewer application to display the result in graph form.

SCPI Application

With the help of SCPI, users can improve their experience when performing measurements and speed up the measurement process. Users can predefine the measurement steps and program them as an automated sequence. In other word, the repetitive steps can be handled by scripting codes. Besides, the programmed sequence can be re-used next time or shared among colleagues to ensure consistency of the measurement steps.

Instead of importing the files from instrument, SCPI can capture the data directly from the instrument and perform post-processing calculation. In this way, the export and import action of measurement result is simplified as it removed the “middle-man” step.

In summary, with the increase in the need for instrumentation that comes with the advancement of telecommunication technologies and industry increasingly becoming interconnected, the usage of SCPI is becoming even more popular. And to engineers working in the telecommunication industry, it is a good skillset to pick up!

In Filpal, we develop SCPI related applications to enhance measurement processes of every experiment. One such application combined setting, measuring, dielectric post-processing, and result viewing in single application. Email us at sales@filpal.com if you find yourself interested to know more!

Originally published at http://filpal.wordpress.com on June 27, 2021.

--

--

FILPAL

FILPAL designs, and builds RF and Microwave software and hardware for Cellular, Military, Academia and Test & Measurement applications. http://www.filpal.com