Standard Commands for Programmable Instruments
Standard Commands for Programmable Instruments (SCPI) is an ASCII-based programming language and standard designed to facilitate communication between computers and test and measurement instruments, providing a uniform set of commands for controlling device functions such as measurement, sourcing, and calibration.[1] Developed by the SCPI Consortium, founded in 1990 by leading test and measurement manufacturers, it extends the IEEE 488.2 standard (1987) by introducing hierarchical, instrument-specific command structures while maintaining compatibility with its syntax, semantics, and error-handling mechanisms.[1] The standard aims to reduce automatic test equipment (ATE) program development time and enhance interoperability across instruments from different vendors, supporting vertical (same instrument type), horizontal (same measurement function), and functional compatibility.[1] SCPI's core framework is outlined in its 1999 specification (SCPI-99), organized into four volumes: Volume 1 covers syntax and style, including command naming conventions and status reporting; Volume 2 provides a reference for common and subsystem-specific commands (e.g., SENS for sensing, SOUR for sourcing, CALC for calculations); Volume 3 defines a block-structured data interchange format for sharing waveforms and other data over protocols like GPIB, RS-232, or LAN; and Volume 4 specifies instrument classes such as power supplies, digital multimeters, oscilloscopes, and RF sources, each with base and optional functionality sets.[1] Commands are structured hierarchically (e.g., :SOUR:FREQ 1GHz to set a signal generator's frequency) and use mnemonic keywords for readability, with query forms (ending in ?) to retrieve instrument states.[1] Since the SCPI Consortium merged with the IVI Foundation in 2003, the standard has been maintained and extended, notably with High-Speed LAN Instrument Protocol (HiSLIP) for network-based delivery of SCPI messages, ensuring compatibility with modern interfaces like Ethernet while remaining hardware-independent.[2] Widely adopted in industries including electronics testing, telecommunications, and automotive, SCPI supports programming in languages such as Python, C++, and MATLAB, and integrates with environments like LabVIEW for automated testing workflows.[2]Introduction
Definition and Purpose
Standard Commands for Programmable Instruments (SCPI) is a standardized, ASCII-based command language designed for controlling programmable test and measurement instruments, such as oscilloscopes, multimeters, and signal generators. It establishes a consistent syntax for remote programming, enabling instruments from different manufacturers to respond to uniform commands for common functions.[1] The primary purpose of SCPI is to promote interoperability in automated test systems by providing an instrument-independent framework that minimizes the need for vendor-specific programming. This reduces development time for automatic test equipment (ATE) applications, simplifies data acquisition and control, and supports efficient integration across diverse hardware setups. By focusing on a hierarchical structure for message exchange, SCPI enhances ease of use while allowing for device-specific extensions without compromising core compatibility.[1][2] According to the SCPI Consortium, the standard specifies the overall command structure, data formats, and response conventions, but deliberately avoids defining instrument-specific functions to encourage broad adoption and flexibility. It builds on the foundational elements of IEEE 488.2 for common commands and status reporting, extending them into a more intuitive, class-consistent language suitable for both GPIB interfaces and other transport mechanisms like Ethernet or RS-232. This approach fosters vendor-neutral automation, making SCPI a cornerstone for reliable, scalable test and measurement environments.[1][2]Relationship to IEEE Standards
SCPI is fundamentally built upon the IEEE 488 standard, which defines the General Purpose Interface Bus (GPIB) for the physical and electrical hardware interface in instrument control systems, and IEEE 488.2, which specifies the basic message exchange protocols, including standard codes, formats, and a set of common commands for device communication.[2] This foundation ensures that SCPI-compliant instruments can interoperate seamlessly over GPIB hardware while adhering to IEEE 488.2's requirements for data formatting and status reporting.[3] SCPI extends IEEE 488.2 by addressing its limitations in command syntax, introducing a more structured, hierarchical approach using mnemonic-based keywords that promote vendor-independent programming.[4] While IEEE 488.2 provides a minimal set of common commands (e.g., *IDN? for identification and *RST for reset), SCPI supersedes this with comprehensive, instrument-class-specific command subsets that maintain backward compatibility but enable more intuitive and extensible control.[3] Key integration points include SCPI's mandatory conformance to IEEE 488.2's status reporting model and message termination rules, allowing hybrid systems where common commands handle universal operations and SCPI commands manage specialized functions.[2] Although rooted in GPIB, SCPI's software-centric design extends its applicability to other interfaces beyond IEEE 488 hardware, including RS-232 serial connections, USB, and Ethernet-based networks.[2] For Ethernet implementations, protocols like VXI-11 enable the transport of SCPI messages over TCP/IP, facilitating remote control in modern LAN environments without relying on physical GPIB cabling.[5] This adaptability has broadened SCPI's use in diverse test and measurement setups, from legacy serial devices to high-speed networked instruments.[2]Historical Development
IEEE 488 and 488.2 Foundations
The IEEE 488 standard, originally published in 1978 as ANSI/IEEE Std 488-1978, introduced the General Purpose Interface Bus (GPIB), a parallel digital interface designed to facilitate data transfer between controllers and programmable instruments in measurement and control systems.[6] This standard defined the electrical, mechanical, and basic functional specifications for connecting up to 15 devices on a single bus, enabling multi-device configurations where one controller could manage multiple talkers and listeners simultaneously.[6] Key features included multi-device addressing via 5-bit addresses (allowing addresses 0-30, though typically 1-15 in practice), and a three-wire handshaking protocol using DAV (Data Valid), NRFD (Not Ready For Data), and NDAC (Not Data Accepted) lines to ensure reliable, asynchronous data transfer at rates up to 1 MB/s over cable lengths not exceeding 20 meters.[6] Building on this foundation, IEEE Std 488.2-1987 extended the IEEE 488.1 bus (a revision of the 1978 standard) by specifying standardized codes, formats, protocols, and common commands to promote interoperability among devices from different manufacturers.[7] It introduced unambiguous syntactic structures for program messages (controller-to-device) and response messages (device-to-controller), including support for device-dependent and application-independent exchanges in small- to medium-scale instrument systems.[7] The standard also defined a hierarchical status reporting system with registers for operation, questionable conditions, and events, along with error handling mechanisms like the Standard Event Status Register (ESR).[7] Common commands such as *IDN? (for device identification query) and *RST (for reset) were mandated, providing essential functions like synchronization (*OPC, *WAI) and clear (*CLS) that all compliant devices must implement.[7] Despite these advancements, IEEE 488.2's command structure was inherently flat and rigid, lacking a hierarchical or tree-like organization that could accommodate the growing complexity of modern instruments with multiple subsystems.[1] This limitation resulted in manufacturer-specific implementations for instrument-specific commands, reducing portability and increasing programming effort in multi-vendor environments, as the standard focused primarily on protocols rather than defining comprehensive, extensible command sets for functional subsystems.[1] Such constraints in flexibility and standardization motivated extensions like SCPI, which built upon IEEE 488.2 to introduce hierarchical structures for more intuitive control of complex devices.[1]SCPI Standardization Process
In 1990, the SCPI Consortium was formed by leading test and measurement companies, including Hewlett-Packard and Tektronix, along with other industry partners, to address the growing problem of vendor-specific command sets that hindered interoperability among programmable instruments.[8] This initiative aimed to create a unified programming language that would extend the capabilities of existing standards like IEEE 488.2, which, while providing a foundation for message exchange, lacked sufficient standardization for device-specific operations across manufacturers.[1] The consortium's efforts were driven by the need for consistent syntax and commands to streamline automated test systems, reducing programming complexity and enabling easier integration of instruments from different vendors. Between 1990 and 1991, the consortium released the first SCPI specification, which established a core syntax framework and defined instrument-specific command subsets for common devices such as multimeters, oscilloscopes, and power supplies.[1] This initial version introduced hierarchical keywords, status reporting mechanisms, and parameter formats that built directly on IEEE 488.2's message structure, ensuring backward compatibility while promoting a more intuitive and extensible command set.[9] The specification emphasized modularity, allowing for both common commands (e.g., for reset and identification) and class-specific extensions, which facilitated rapid adoption in laboratory and production environments. Key adoption milestones included the specification's integration as a compatible layer atop IEEE 488.2, with early implementations appearing in commercial test equipment by the early 1990s. By 1995, SCPI had achieved widespread use in the industry, powering automated test setups in sectors like electronics manufacturing and telecommunications, as evidenced by its incorporation into standards like VXIplug&play drivers.[10] This period marked a shift toward standardized instrument control, with major vendors committing to SCPI compliance to enhance system portability. The SCPI Consortium continued to evolve through the 1990s, refining the standard via iterative releases, before merging into the IVI Foundation in late 2002, with formal acceptance in spring 2003, to broaden its scope within interchangeable virtual instrumentation frameworks.[8] This transition ensured ongoing maintenance and expansion of SCPI for emerging bus technologies while preserving its core principles.Key Revisions and Updates
The SCPI-99 revision, released in 1999 by the SCPI Consortium, introduced several key enhancements to improve robustness and usability. It expanded error handling capabilities by defining additional error codes in the -200 series for execution errors, such as -201 for invalid commands in local mode and -221 for settings conflicts, while clarifying the behavior of the *CLS command to clear status structures without affecting enable registers. The revision also added support for floating-point parameters through the REAL data type, compliant with IEEE 754 standards, allowing commands like SOURce:FREQuency:CW to accept 32- or 64-bit numeric values, including representations for infinity (9.9E37) and not-a-number (9.91E37). Furthermore, it clarified query responses to ensure consistency, mandating short-form outputs for character data and fundamental units for numerics, with no side effects from queries except in specific measurement subsystems, and standardizing formats for commands like SYSTem:ERRor? to return paired error numbers and descriptions.[1] In the 2000s, SCPI saw significant integration with the Interchangeable Virtual Instrumentation (IVI) Foundation's driver architecture, positioning SCPI commands as a foundational subset for IVI drivers to enable software abstraction across diverse hardware. This alignment facilitated interchangeable instrument control, where IVI drivers could interpret SCPI messages for underlying instruments, reducing vendor-specific coding needs. The SCPI Consortium's merger with the IVI Foundation in late 2003 formalized this integration, transferring maintenance responsibilities and ensuring SCPI's evolution aligned with broader virtual instrumentation standards like VISA for communication protocols.[2][8] Post-2010 developments extended SCPI's compatibility with emerging modular standards such as LXI (LAN eXtensions for Instrumentation) and PXI (PCI eXtensions for Instrumentation), adapting the command set to Ethernet-based and high-speed bus environments without altering core syntax. For LXI, which emphasizes networked control, SCPI commands are routinely transported over TCP/IP, leveraging HiSLIP protocols for session management, while LXI's mandatory web interfaces enable browser-based SCPI execution for configuration and monitoring. In PXI systems, SCPI supports modular instrumentation through register-based or message-passing drivers, maintaining interoperability in high-density test setups. These extensions preserved SCPI's hardware independence, allowing seamless use across GPIB, USB, and LAN interfaces in modern automated test equipment.[11][12][13] As of 2025, SCPI remains under the stewardship of the IVI Foundation, with no major overhauls since SCPI-99 but continued emphasis on vendor compliance through updated guidelines and shared components for driver development. The Foundation's recent releases, such as new .NET shared components in May 2025, support ongoing enhancements to SCPI's integration with contemporary protocols like HiSLIP, ensuring long-term viability in test automation without disrupting established implementations.[14][15]Core Principles
Message Exchange Model
The message exchange model in SCPI defines the protocol for communication between a controller and programmable instruments, building directly on the IEEE 488.2 standard for codes, formats, and protocols. This model ensures reliable, sequential interaction over interfaces like GPIB, RS-232, or USB, where commands are sent from the controller and responses or status updates are returned from the instrument.[1] Controller-to-instrument command messages consist of one or more device commands formatted as ASCII text and terminated by a line feed (LF) character, which signals the end of the message to the instrument. Instruments process command messages sequentially in the order received. While most commands execute synchronously, SCPI supports overlapped (asynchronous) commands for certain operations, with synchronization provided by mechanisms such as *OPC and *WAI to ensure predictable control flow.[1][16] Instrument-to-controller response messages are generated in reply to query commands and similarly terminated by an LF character, placing the response data into the instrument's output queue for retrieval by the controller. These responses adhere to IEEE 488.2 formatting rules, typically in ASCII, and may include measurement data, status information, or error messages queued for sequential output.[1][16] SCPI distinguishes between program messages and device messages to handle complex inputs efficiently: a program message is a complete controller input containing multiple device commands separated by semicolons, while each device message represents a single, parsed command unit executed independently by the instrument. This separation allows the controller to send batches of commands in one transmission, with the instrument parsing and processing them as discrete units.[1] For flow control, SCPI incorporates IEEE 488.2 mechanisms such as Device Clear (DCL), a universal bus command that resets all instruments to a known power-on state, clears input/output buffers, and aborts ongoing operations without affecting local control. Selective Device Clear (SDC), addressed to a specific instrument, performs a similar reset on the targeted device, halting execution and clearing buffers while preserving the overall bus state. These controls enable the controller to interrupt or reinitialize instruments as needed during testing or measurement sequences.[1][16]Hierarchical Command Structure
The Standard Commands for Programmable Instruments (SCPI) organizes its device-specific commands into a hierarchical, tree-like structure that facilitates logical grouping of related functions, enhances readability, and promotes extensibility across diverse instruments. This inverted tree model begins at root nodes representing broad instrument subsystems and branches into increasingly specific subcommands, separated by colons to delineate levels. By structuring commands this way, SCPI ensures a standardized yet flexible framework for controlling programmable instruments, allowing programmers to navigate from general categories to precise operations without ambiguity.[1] At the root level, SCPI defines several primary command classes that address core instrument functions, such as measurement initiation and configuration. For instance, theMEASure root class combines setup and execution to perform and return a measurement, as in MEASure:VOLTage?, which queries voltage data. Similarly, CONFigure establishes measurement parameters without triggering acquisition, exemplified by CONFigure:VOLTage for voltage setup, while FETCh retrieves data from a prior acquisition, such as FETCh:VOLTage?. These roots serve as entry points to subsystems like triggering, sourcing, or calculation, enabling a modular approach to instrument control.[1]
Subsequent levels build on these roots through colon-separated keywords, forming a path to granular settings; for example, :TRIGger:EDGE:SLOpe specifies the slope for an edge trigger within the trigger subsystem. The hierarchy typically employs up to three or four levels of depth to accommodate complex instrument features while maintaining simplicity in command formulation.[1]
SCPI's design emphasizes extensibility, permitting instrument vendors to introduce proprietary branches or additional keywords without disrupting standard compliance. Parsers in compliant instruments ignore unrecognized elements in the hierarchy, ensuring backward compatibility and allowing custom extensions like vendor-specific calibration routines (e.g., :CALibration:LINearize:ACQuire). This vendor-neutral extensibility supports innovation in specialized applications while preserving the core tree structure for interoperability.[1]
Status Reporting System
The Status Reporting System in SCPI provides a structured mechanism for programmable instruments to report operational status, events, and errors to the controller, enabling reliable remote monitoring and synchronization. This system builds directly on the status reporting framework defined in IEEE Std 488.2-1987, which SCPI mandates for full implementation, including registers that capture device conditions without interrupting ongoing operations.[1] At the core of this system are the Standard Event Status Enable Register (ESE) and the Status Byte Register, both inherited from IEEE 488.2. The ESE is an 8-bit register that allows the controller to selectively enable specific events from the Standard Event Status Register (ESR) to contribute to the overall status summary; for instance, enabling bit 4 would flag execution errors when they occur. The Status Byte Register serves as the primary summary register, an 8-bit structure that aggregates status bits from various subsystems, such as bit 5 for standard event status (ESB) and bit 2 indicating a non-empty Error/Event Queue. These registers ensure asynchronous event reporting via service requests (SRQ), where the instrument can signal the controller when enabled conditions are met.[1][1] SCPI extends this IEEE 488.2 foundation with the Output Queue and Event Queue to enhance response handling and error logging. The Output Queue stores instrument responses to query commands, ensuring they are delivered in the order generated and preventing loss during asynchronous operations; for example, the *OPC? command places a "1" in this queue upon completion of pending operations. The Event Queue, a first-in-first-out (FIFO) structure with a minimum capacity of two entries, records detailed error messages in human-readable format, with overflows generating error -350 ("Too many errors"). This queue is cleared by the *CLS command, which also resets associated status bits but preserves transition filters in enable registers.[1][1] Instruments query these structures using specific SCPI commands to retrieve status information. The *ESR? command reads the contents of the Standard Event Status Register, returning a decimal value representing enabled events such as power-on (bit 7) or command errors (bit 5). Similarly, *STB? queries the Status Byte Register, providing a bitwise summary that includes the Requesting Service (RQS) bit (bit 6) for SRQ handling. These queries support real-time polling without altering the register states.[1] The system categorizes errors reported through the Event Queue into execution errors and device-specific errors, standardizing diagnostics across instruments. Execution errors, ranging from -299 to -200, arise from command processing issues; a common example is -113 ("Undefined header"), triggered by unrecognized SCPI keywords. Device-specific errors, spanning -399 to -300 or +1 to +32767, reflect instrument-unique conditions, such as +100 ("Range overflow") in measurement devices when inputs exceed limits. These error codes facilitate precise troubleshooting while maintaining compatibility with IEEE 488.2 event bits, like bit 4 in the ESR for execution errors and bit 3 for device-specific ones.[1]Command Syntax
Case and Keyword Rules
SCPI commands are case-insensitive, meaning that instruments must accept keywords regardless of whether they are entered in uppercase, lowercase, or a mixed case combination, without distinguishing between cases. For instance, the keyword "MEASure" is equivalently recognized as "measure", "MEAS", or "MeAsUrE", provided the characters form a valid, unambiguous abbreviation. This flexibility simplifies programming while maintaining compatibility across different instrument implementations.[1] Keywords in SCPI form the core of command structure, consisting of one or more mnemonics that represent specific functions or subfunctions. In documentation, keywords are conventionally presented in mixed case, with uppercase letters indicating the minimum set of characters required for unique identification—the short form—while the full long form may include additional lowercase letters for clarity. Instruments are required to accept either the complete keyword or any shortened version that unambiguously matches it, with a maximum keyword length of 12 characters, including any numeric suffixes. For example, "FREQuency" accepts "FREQ" as its short form, but the instrument determines the precise minimum based on avoiding conflicts with other keywords. The defined short form is typically the first four or more characters of the long form, with rules such as dropping the fourth vowel if present to ensure uniqueness (e.g., 'SWEEp' shortens to 'SWE').[1] Hierarchical relationships between keywords are denoted by colons (:), which separate levels in the command tree; for example, "SENSe:FREQuency" specifies the frequency subsystem under the sense hierarchy. Within a single program message, multiple independent commands can be concatenated using semicolons (;), such as "*RST;SYSTem:ERRor?", allowing efficient transmission of sequential instructions without separate messages. These punctuation rules ensure structured and readable message formatting.[1] In query responses, instruments return keywords exclusively in uppercase, typically using the short form to minimize data transfer. For example, a query on a calculation function might yield "CALC3" rather than the expanded "CALCulate3", adhering to IEEE 488.2 response data conventions for consistency.[1]Abbreviation and Concatenation
In SCPI, command keywords can be abbreviated to their defined short form or any longer form that includes the short form and unambiguously matches the long form, as partial forms shorter than the short form cause errors, thereby reducing message length and improving communication efficiency. For example, the full keyword "MEASure?" can be shortened to "MEAS?" for a query command, as "MEAS" is the defined short form sufficient to distinguish it from other keywords like "MEASure:CURRent?" or "MEASure:VOLTage?". If an abbreviation creates ambiguity—such as using "FRE" when both "FREQuency" and "FREe" exist in the command tree—the instrument must reject the command and report a "Command error" (error code -113) via the error queue. This rule ensures reliable parsing while allowing flexibility; the exact minimal length depends on the specific instrument's implementation of the SCPI standard.[1][17] Abbreviation applies hierarchically to each keyword in a command tree, separated by colons, and is case-insensitive, consistent with general SCPI keyword formatting rules. Programmers should consult the instrument's manual for the defined short forms, as the SCPI specification requires instruments to accept both the full mnemonic and any valid shortened version but does not mandate a universal minimum length beyond uniqueness. Using non-unique or invalid abbreviations triggers immediate error handling without execution of the affected command.[1][18] Concatenation allows multiple independent SCPI commands or queries to be combined into a single program message, separated by semicolons (;), which enables efficient batching of operations over the interface. For instance, "*RST; :SOURce:VOLTage 5; :OUTPut ON" resets the instrument, sets a voltage, and enables the output in one transmission, with the semicolon linking commands without altering the root header path unless a colon follows it (e.g., ";:" to explicitly reset to root). This structure maintains the hierarchical context for subsequent commands unless explicitly reset, promoting streamlined programming. Some instrument implementations impose practical limits on the number of concatenated commands per message to prevent buffer overflows, though the SCPI standard itself specifies no universal cap beyond overall message length constraints defined in IEEE 488.2.[1][17]Parameter Specification
In SCPI, parameters, also known as arguments, provide the specific values or settings required by commands to configure or query instrument functions, adhering to formats defined in the SCPI standard which builds upon IEEE 488.2 conventions.[1] These parameters must follow precise rules to ensure interoperability across programmable instruments, with types including numeric values, strings, and booleans to accommodate diverse data needs such as measurements, states, and text inputs.[1] Numeric parameters are expressed in decimal or scientific notation as per the IEEE 488.2:SOURce:VOLTage 5.0 for a 5-volt setting or :FREQ:CENT 1.23E6 for 1.23 MHz in scientific notation.[1] Special numeric keywords such as MINimum, MAXimum, DEFault, UP, or DOWN can substitute for explicit values to set limits or increments, with units like V (volts) or MHZ optionally appended for clarity, defaulting to the instrument's fundamental units if omitted.[1] Strings are enclosed in double quotes to handle text data, such as labels or identifiers, and are case-sensitive in contexts like passwords while remaining case-insensitive for keywords; an example is :DISPlay:TEXT "Sample Label".[1] Boolean parameters accept ON (or 1) to enable a function and OFF (or 0) to disable it, with queries returning 0 or 1; for example, :OUTPut:STATe ON activates an output.[1]:SOURce:VOLTage:LEVel:IMMediate:AMPLitude 5.0, DC to specify both amplitude and waveform type.[1] Optional parameters, denoted in command definitions by square brackets, can be omitted to invoke instrument-specific defaults, such as resetting a span to its maximum value in :SENSe:FREQuency:SPAN.[1] These defaults are device-dependent but often align with common states like OFF for outputs at reset (*RST command), ensuring predictable behavior without exhaustive parameter specification.[1]
For variable-length data, such as binary blocks or arbitrary strings, SCPI employs macro parameters in the form of definite length blocks prefixed by a pound sign (#), followed by a digit indicating the length byte count and then the data; for example, #4DATA denotes a 4-byte block starting after the length indicator, facilitating efficient transfer of non-textual information like trace data in :TRACe:DATA?.[1] This format, inherited from IEEE 488.2, supports up to 255 characters for strings in many cases and prevents parsing errors in concatenated command strings.[1]
Common and Device-Specific Commands
IEEE 488.2 Common Commands
The IEEE 488.2 common commands provide a standardized set of instructions for basic control and status management of programmable instruments connected via the IEEE 488 bus, ensuring interoperability across devices from different manufacturers. These commands, prefixed by an asterisk (*) to distinguish them from device-specific instructions, form the foundation for higher-level protocols like SCPI and are mandatory for compliance with the IEEE 488.2-1992 standard. They address essential functions such as device identification, reset, status clearing, and operation synchronization, integrating with the standard's status reporting system to enable reliable remote programming.[1][16] The *IDN? query command requests identification information from the instrument, returning a comma-separated string typically including the manufacturer's name, model number, serial number, and firmware or software version. This response allows programmers to verify device presence and configuration without prior knowledge of the instrument's specifics, making it a fundamental tool for system initialization and troubleshooting. For example, a typical output might be "Manufacturer,Model123,Serial456,V1.2.3".[1][19] The *RST command performs a reset, returning the instrument to its power-on or default state, which includes stopping any ongoing operations, setting parameters like continuous initiation to off, and configuring ranges to minimum or maximum values as defined by the device. It does not affect non-volatile memory or calibration data but clears pending overlapped commands and sets the no-operation-pending flag to true, ensuring a predictable starting point for subsequent programming. This command is particularly useful for recovering from error states or standardizing instrument behavior across sessions.[1][19] The *CLS command clears all status data structures, including the Standard Event Status Register (SESR), other event registers, and the error queue, while also canceling any pending *OPC messages. It does not alter enable registers, preserving user-defined status reporting configurations, and serves to reset the instrument's status byte to zero for clean operation. By integrating with the IEEE 488.2 status reporting system, *CLS enables controllers to eliminate accumulated errors or events before issuing new commands, promoting robust error handling in automated test environments.[1][19] The *OPC? query and *OPC command handle asynchronous operation completion signaling. *OPC sets the Operation Complete (OPC) bit in the Status Byte Register or SESR once all pending device operations finish, allowing the controller to poll for readiness via the status byte. In contrast, *OPC? is a sequential query that holds execution until operations complete, then returns the ASCII string "1" to confirm. These mechanisms are essential for synchronizing multi-command sequences, especially with time-intensive tasks like measurements, ensuring the controller does not proceed prematurely.[1][19] All IEEE 488.2 common commands must be implemented in SCPI-compliant instruments to guarantee consistent behavior, with the asterisk prefix enforcing their universal applicability and preventing conflicts with instrument-class commands. Their adoption in SCPI extends the IEEE 488.2 framework, mandating support for these functions to facilitate plug-and-play integration in test systems.[1][16]Instrument Class Commands
Standard Commands for Programmable Instruments (SCPI) defines specialized command subsets tailored to major categories of test and measurement instruments, enabling consistent control and data acquisition across compatible devices.[1] These subsets leverage a hierarchical structure where commands are organized into trees using colons to separate subsystems, such as SENSe or SOURce, allowing precise navigation to instrument-specific functions.[1] For the multimeter class, SCPI specifies commands primarily under the MEASure and SENSe subsystems to handle scalar measurements like voltage, current, and resistance.[1] A key command isMEASure:VOLTage?, which queries the instrument for a voltage reading in either DC or AC mode, optionally specifying an expected value and resolution for autoranging support; for example, MEASure:VOLTage:[DC](/page/DC)? 5,0.001 requests a DC voltage measurement around 5 volts with 1 mV resolution.[1] Supporting commands include [SENSe](/page/Sense):VOLTage:[DC](/page/DC):[RANGe](/page/Range):UPPer <value> to set the maximum range, such as 10 volts via [SENSe](/page/Sense):VOLTage:[DC](/page/DC):[RANGe](/page/Range):UPPer 10, and [SENSe](/page/Sense):VOLTage:[AC](/page/AC):[RESolution](/page/Resolution) <value> for precision in AC measurements, like [SENSe](/page/Sense):VOLTage:[AC](/page/AC):[RESolution](/page/Resolution) 0.01.[1] These ensure accurate, device-independent voltage acquisition while accommodating subclasses like DCVOLTMETER and ACVOLTMETER.[1]
In the oscilloscope class, commands focus on waveform capture, timebase control, and display management, centered around the WAVEform and SENSe subsystems.[1] The WAVEform:DATA? command retrieves acquired waveform data from a specified channel or handle, supporting formats like INT16 for binary transfer; an example is WAVEform:DATA? CHAN1 to fetch data from channel 1.[1] Related functions include SENSe:SWEep:POINts <value> to define the number of acquisition points, such as SENSe:SWEep:POINts 1000 for 1000-point sweeps, and SENSe:SWEep:TINTerval <value> to set the time interval, like SENSe:SWEep:TINTerval 0.001 for a 1 ms base.[1] Additional measurements, such as rise time via MEASure:VOLTage:RISE:TIME? 10,90 between 10% and 90% levels, enhance time-domain analysis in real-time modes.[1]
The power supply class employs commands under the OUTPut and SOURce subsystems to manage output enabling, voltage/current levels, and protection features.[1] Central to this is OUTPut:[STATe](/page/State) <Boolean>, which turns the output on or off, with the default OFF state upon reset; for instance, OUTPut:[STATe](/page/State) ON enables the supply.[1] Current amplitude is set via SOURce:CURRent:LEVel:IMMediate:[AMPLitude](/page/Amplitude) <value> in amperes.[1] Protection activation occurs with OUTPut:PROTection:[STATe](/page/State) <Boolean>, such as OUTPut:PROTection:[STATe](/page/State) ON, to safeguard against overvoltage or overcurrent conditions.[1]
SCPI enforces class independence by requiring instruments to implement only the command subsets relevant to their functionality, with mandatory compliance for all supported features to ensure interoperability.[1] Unsupported commands trigger -113 (Undefined header), while invalid parameter combinations may trigger -221 (Settings conflict), allowing devices like a basic voltmeter to omit advanced trigger controls while fully supporting core SENSe measurements.[1] This modular approach accommodates diverse hardware, such as combining subclasses like DCVOLTMETER with SWITCHER in a single instrument via specifiers like (DCVOLTMETER&SWITCHER WITH SCAN).[1]
Query Mechanisms
In SCPI, queries are formed by appending a question mark (?) to the end of a command, instructing the instrument to return specific data or status information rather than performing an action. For instance, the command SYSTem:ERRor? retrieves the next entry from the instrument's error queue, returning both a numeric error code and an associated string message describing the event. This format ensures a clear distinction between commands that set parameters and those that solicit responses, promoting interoperability across programmable instruments.[1] Responses to SCPI queries can consist of numeric data, such as non-decimal (NR1), decimal (NR2), or scientific notation (NR3) formats for measurements like voltage or frequency values; string data, including character sequences, quoted phrases, or comma-separated lists for messages and configurations; or indefinite-length data, typically represented as arbitrary response blocks for large datasets like waveform samples. Indefinite-length responses begin with a block header specifying the data type and length, allowing efficient transfer of variable-sized information without prior knowledge of the exact byte count. These response types adhere to the data formats defined in the SCPI standard, ensuring consistency in parsing across controllers and instruments.[1] To prevent race conditions and maintain sequential execution, SCPI prohibits overlapping queries: a controller must not send a new command until the instrument has fully transmitted the response to the previous query. This rule blocks the instrument's input buffer during response generation, avoiding interference with ongoing operations. For synchronization in asynchronous scenarios, such as after initiating a lengthy measurement, the common command *OPC? (Operation Complete?) is used; it queries the output queue and returns a "1" once all prior operations finish, confirming readiness for subsequent commands.[1] All SCPI responses terminate with a line feed (LF) character to signal completion, facilitating easy detection by the controller. For multi-line responses, such as those listing catalog entries or error queues, an optional new line (NL) may precede the LF in each line, though the standard requires only the final LF for the entire block. This termination convention aligns with IEEE 488.2 protocols, ensuring reliable end-of-message detection in bus-based systems.[1]Implementation Guidelines
Communication Protocols
SCPI implementations rely on a variety of hardware and software interfaces to enable communication between controllers and instruments, ensuring compatibility across legacy and modern systems. The standard defines how SCPI messages—ASCII-based commands and responses—are transported over these interfaces without altering the core command syntax. This hardware independence allows SCPI to layer atop existing bus protocols, facilitating interoperability in test and measurement environments.[2] The primary interface for SCPI is IEEE 488, also known as the General Purpose Interface Bus (GPIB), which operates on a parallel bus architecture supporting up to 15 devices. In this setup, instruments function in talker and listener roles: a controller addresses an instrument as a listener to send commands, then re-addresses it as a talker to receive responses, adhering to the handshaking protocol defined in IEEE 488.1 for physical and electrical characteristics, while IEEE 488.2 governs the data formats and message exchange. SCPI commands are transmitted as device messages within this framework, ensuring reliable asynchronous communication at speeds up to 1 MB/s over distances of up to 20 meters with appropriate cabling.[2][4][20] For serial communications, SCPI supports RS-232 and RS-485 interfaces, which provide point-to-point or multi-drop connectivity suitable for shorter-range or industrial applications. RS-232 enables full-duplex communication over distances up to 15 meters, while RS-485 supports half-duplex multi-device networks over longer distances up to 1,200 meters. Baud rates are configurable via SCPI commands such asSYSTem:COMMunicate:SERial:BAUD <rate>, with common settings ranging from 9,600 to 115,200 bits per second to balance speed and reliability; for instance, 9,600 baud is often used for compatibility with legacy systems. These interfaces transmit SCPI messages as asynchronous byte streams, with flow control options like hardware handshaking (RTS/CTS) or software (XON/XOFF) to manage data integrity.[21][22][23]
Modern interfaces extend SCPI to networked and plug-and-play environments. Over Ethernet, TCP/IP protocols such as VXI-11 and HiSLIP enable remote control, with VXI-11 providing a core, abort, and interrupt channel for command execution, data transfer, and synchronization, supporting SCPI via LAN at gigabit speeds. HiSLIP, developed by the IVI Foundation, improves upon VXI-11 by offering lower latency and better GPIB emulation through "fire-and-forget" messaging and remote locking mechanisms, making it suitable for high-throughput applications. For USB connectivity, the USB Test and Measurement Class (USBTMC) subclass defines a bulk transfer protocol that encapsulates SCPI commands within USB packets, using endpoints for request/response and allowing hot-plugging without custom drivers; it supports data rates up to 480 Mbps on USB 2.0, with instruments appearing as virtual serial ports to software like VISA.[5][12][24][25]
At the protocol layering level, SCPI operates as an application-layer standard, with its messages encapsulated within interface-specific framing to handle transport, synchronization, and error signaling. For GPIB, SCPI device messages are wrapped in IEEE 488.2 formats including headers for addressing and terminators like line feeds. Serial interfaces add framing with start/stop bits and parity, while Ethernet protocols like HiSLIP embed SCPI payloads in TCP segments with additional meta-messages for flow control and status. USBTMC similarly encapsulates commands in bulk OUT/IN transfers prefixed by USBTMC headers specifying message length and type, ensuring seamless integration across buses while preserving the abstract message exchange model of command termination and query responses.[2][4][26]
Error Detection and Handling
In SCPI communications, error detection relies on an instrument's internal parser to identify syntax, semantic, and execution issues during command processing, with errors queued for retrieval by the controller. The error queue operates on a first-in, first-out (FIFO) basis, storing error codes and descriptive messages; theSYSTem:ERRor[:NEXT]? command retrieves and removes the oldest unread entry, returning a format like "-113,'Undefined header'" followed by advancing the queue pointer.[1] Queue capacity is device-dependent but typically ranges from 10 to 50 entries, with a minimum of two as mandated by the SCPI-99 standard (building on IEEE 488.2); upon overflow, the instrument generates error -350 ("Too many errors") and discards the newest entry.[1] The queue is cleared by the *CLS (Clear Status) command, power cycle, or by reading all entries, and its non-empty state sets bit 2 in the Status Byte Register for polling detection.[1]
SCPI defines standardized error categories to classify issues, enabling consistent handling across instruments; these align with IEEE 488.2 codes but extend to device-specific ranges. The following table summarizes the primary categories:
| Category | Code Range | Description |
|---|---|---|
| Command Errors | -199 to -100 | Indicate IEEE 488.2 syntax or semantic violations, such as invalid characters or undefined headers (e.g., -113 for unrecognized commands).[1] |
| Execution Errors | -299 to -200 | Arise during command execution, including invalid parameters or resource unavailability (e.g., -221 for settings conflict).[1] |
| Device-Specific Errors | -399 to -300 | Instrument-specific issues, such as hardware faults or calibration failures (negative codes per SCPI-99; positive codes may be used for additional vendor-defined errors).[1] |
*ESR? (Event Status Register query) after critical commands to detect bit flags for errors, followed by querying SYSTem:ERRor? to retrieve details and clear the queue entry.[1] For transient issues like resource locks (-201 to -219), retry logic with delays (e.g., 100-500 ms) and command reissuance is recommended, while persistent errors may require instrument reset via *RST to restore a defined state.[1] Overlapped command execution, as per IEEE 488.2, demands careful synchronization using *OPC? or *WAI to avoid error propagation from asynchronous operations.[1]
Debugging leverages the *TST? (self-test) command, which initiates an instrument diagnostic routine and returns 0 for pass or a non-zero code indicating failure specifics, aiding isolation of hardware or firmware faults before deeper queue analysis.[1] Instruments must support this for compliance, ensuring controllers can verify operational integrity post-error.[1]