2. Introducing SCPI Commands
In 1975, the IEEE standardized a bus developed by Heweltt-Packard originally called HPIB (Hewlett-Packard Interface Bus), later changed to GPIB (General Purpose Interface Bus). The standard was called IEEE 488 (IEEE 488.1) and it defined mechanical aspects of the bus. The later IEEE 488.2 defined its protocol properties. What was missing were set of rules between the manufacturers on commands to control the instruments. Sometimes these varied even between different models from the same manufacturer.
In 1990 SCPI Consortium released the first SCPI standard (Standard Commands for Programmable Instruments) as an additional layer for the IEEE-488.2 standard.
SCPI commands are ASCII strings, which are sent to instrument over the physical communication layer. They can perform:
- Set operations, for example the *RST command (resetting the instrument).
- Query operations, for example the *IDN? query (querying the instrument’s identification string).
Some SCPI commands exist as both set commands and query commands. An example is an oscilloscope’s acquisition time command "TIMebase:ACQTime". You can set it with the SCPI command "TIM:ACQT 10ms", and also query its current value with the "TIM:ACQT?".
The format mentioned in Rohde & Schwarz user manuals e.g.: "TRIGger<m>:LEVel<n>[:VALue] <Level>" is called canonical form. Here are the most important rules to remember:
- The parts within square brackets are not mandatory and can be left out.
- The capital letter parts are mandatory; the small letters can be omitted. This is called short form. An example of the above command in the short form is "TRIG1:LEV2 3.5". You can use either the short form, or the long form "TRIGGER1:LEVEL2 3.5", but nothing in between, e.g. "TRIGGE1:LEVE2 3.5".
- The SCPI commands are case-insensitive. You can also use the short form "trig1:lev2 3.5" or or the long form "trigger1:level2 3.5"
- Combine multiple commands into one string using selmicolon ';'. For example, a combined string of "TRIG1:SOUR CH1" and "TRIG1:LEV2 3.5" is "TRIG1:SOUR CH1;LEV 2". Notice that the second command does not have the "TRIG1:" part. The reason is, that the command tree path does not change within one string. If you want to reset the command tree path to the root, use the colon character at the beginning of the second command: "TRIG1:SOUR CH1;:CHAN2:STATe ON".
- Create query forms by adding a question mark, mostly to the end: "TRIG1:LEV2?" Sometimes there is an additional parameter placed after the question mark. There must be a space character between the question mark and the additional parameter. For example: "TRACE:DATA? ALL"
- Numeric parameters without specifying the units are considered based units. In our case, the numeric parameter 3.5 means 3.5 Volts.
The complete SCPI standard is available here: SCPI-99
Check out our dedicated description of SCPI: Remote Control via SCPI