> For the complete documentation index, see [llms.txt](https://www.opal-rt.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.opal-rt.com/docs/rt-lab/configure-ios/communication-protocol-ios/scpi.md).

# SCPI

## Introduction to SCPI Protocol

**SCPI (Standard Commands for Programmable Instruments)** is a standardized **application‑layer command language** used to remotely control programmable test and measurement instruments (e.g., oscilloscopes, power supplies, signal generators, DAQs). It defines a common **command syntax, structure, and data formats** so that similar instrument functions can be automated in a consistent way across vendors and models.

SCPI was designed as a software layer built on **IEEE 488.2** (“Standard Codes, Formats, Protocols, and Common Commands”). It leverages IEEE 488.2 conventions (message formatting, common commands, status model), while remaining **hardware‑independent**, meaning SCPI commands can be transported over many physical and network interfaces.

SCPI **defines command semantics** (what the instrument should do) and standardizes many command families (e.g., `MEASure`, `CONFigure`) while allowing vendor extensions. SCPI messages are typically **ASCII text strings**, with optional binary payloads for bulk transfers.

## Protocol characteristics

* **Application‑layer, command/response model**\
  SCPI uses a **controller → instrument** interaction pattern: the controller sends **program messages** (commands), and the instrument returns **response messages** (typically for queries). Queries are identified by a trailing `?`.
* **Hierarchical command tree (subsystems)**\
  SCPI commands are organized as a **tree of keywords** separated by colons `:` (e.g., `SOURce:VOLTage:LEVel`). A root keyword plus its branches is often referred to as a **subsystem**.
* **Short form vs. long form keywords**\
  Each keyword node may have a **long form** and a **short form**. Specifications and manuals often indicate this by capitalization (uppercase letters denote the required part). Instruments accept the exact short form or the exact long form (case‑insensitive), but not arbitrary abbreviations.
* **Message composition and path behavior**\
  Multiple commands can be combined in a single message using semicolons `;`. When multiple commands share the same command path, later commands may omit repeated path elements; a leading `:` can be used to reset the path back to the root.
* **Hardware/interface independence**\
  SCPI does **not** define the physical link. The same SCPI strings may be transported over **GPIB (IEEE‑488.1), RS‑232, USB, Ethernet/LAN**, and other interfaces depending on the instrument.

## How the protocol works

* **Addressing & configuration (depends on transport)**\
  Because SCPI is transport‑agnostic, the way an instrument is addressed depends on the selected communication interface: with **GPIB (IEEE‑488.1/488.2)**, devices are identified by a primary GPIB address while IEEE 488.2 defines the common command and status conventions; with **serial interfaces** such as RS‑232, RS‑422, or RS‑485, communication relies on configured baud rate and framing parameters and typically uses message terminators such as line feed (LF); and with **LAN/Ethernet**, SCPI commands are commonly exchanged over raw TCP sockets or via LAN instrument protocols such as VXI‑11 and HiSLIP, most often accessed through VISA.
* **Command types**\
  SCPI usage commonly includes **set commands**, which configure an instrument state (for example, `SOUR:VOLT 12`), **query commands**, which read back a configuration value or measurement and are identified by a trailing question mark (for example, `MEAS:VOLT?`), and **common commands**, defined by IEEE 488.2 and prefixed with an asterisk, which provide standardized functions such as identification, reset, status handling, and synchronization (for example, `*IDN?`, `*RST`, `*CLS`, and `*OPC?`).
* **Data encoding & responses**\
  Commands are typically transmitted as ASCII strings, while responses are most often returned as ASCII numeric or text values; for high‑volume or waveform data transfers, some instruments may use binary formats depending on their implementation. Parameters are separated from the command keyword path by whitespace, and when multiple parameters are required, they are generally comma‑separated following standard SCPI syntax rules.
* **Message terminators and parsing behavior**\
  Many SCPI implementations treat a message terminator (often newline/LF) as the end of a program message and may reset the current command path. Exact behavior can vary, but the command tree and delimiter rules (colon pathing, whitespace separation, commas for multiple parameters) are core conventions.

### Protocol characteristics (operational considerations)

* **Synchronization & status model**\
  SCPI instruments commonly implement the IEEE 488.2 status and synchronization model through a set of standardized common commands, including `*OPC` and `*OPC?` to signal or query operation completion, `*WAI` to block execution until all pending operations are finished, and status or event‑related queries such as `*STB?`, `*ESR?`, and `*SRE` to manage status reporting and service requests; together, these commands are widely used to coordinate measurement sequences, synchronize control logic, and ensure that an instrument has fully completed prior operations before subsequent actions are executed.
* **Reliability & latency (transport‑dependent)**\
  SCPI itself does not guarantee timing or delivery; these properties come from the transport: for example, raw TCP sockets provide reliable, ordered delivery, while UDP (less common for SCPI) does not. LAN instrument protocols such as VXI‑11 and HiSLIP provide instrument‑style sessions over TCP/IP.
* **Security model (protocol‑agnostic)**\
  SCPI is fundamentally a command language and does not inherently define encryption or authentication. Security is typically achieved via network controls or secure session protocols where available (e.g., some modern instrument stacks can support secure connections depending on protocol/library support).

## Example applications

* **Automated Test Equipment (ATE) & Production**\
  SCPI enables repeatable automation of instrument configuration, stimulus generation, and measurement readback across test stations and manufacturing lines.
* **Lab automation & characterization**\
  Engineers use SCPI to sweep parameters (frequency, voltage, load), capture measurement results, and log data to analysis pipelines (e.g., via Python/C#/LabVIEW).
* **Instrument remote control over LAN**\
  SCPI is commonly sent over LAN using raw sockets or VISA‑managed sessions (VXI‑11/HiSLIP), enabling remote bench control and integration into distributed test systems.
* **Interoperability across vendors**\
  Because SCPI standardizes syntax and many command families, multi‑vendor systems can often share higher‑level automation patterns (with some vendor‑specific command differences for advanced features).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://www.opal-rt.com/docs/rt-lab/configure-ios/communication-protocol-ios/scpi.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
