Standard Commands for Programmable Instruments: Difference between revisions

Content deleted Content added
External links: remove year
 
(36 intermediate revisions by the same user not shown)
Line 9:
SCPI was defined as an additional layer on top of the {{nowrap|IEEE 488.2-1987}} specification "Standard Codes, Formats, Protocols, and Common Commands".<ref>[http://zone.ni.com/devzone/cda/tut/p/id/3419 ni.com - History of GPIB - Developer Zone]</ref> The standard specifies a common [[syntax]], [[command (computing)|command]] structure, and [[Data type|data format]]s, to be used with all instruments. It introduced generic commands (such as <code>CONFigure</code> and <code>MEASure</code>) that could be used with any instrument. These commands are grouped into subsystems. SCPI also defines several classes of instruments. For example, any controllable [[power supply]] would implement the same <code>DCPSUPPLY</code> base functionality class. Instrument classes specify which subsystems they implement, as well as any instrument-specific features.
 
The physical hardware communications link (physical layer) is not defined by SCPI.<ref name="IVI-SCPI"/> While it was originally created for the [[IEEE-488]].1 (GPIB) bus,<ref name="IVI-SCPI"/> SCPI can also be used with [[RS-232]], [[RS-422]], [[EthernetRS-485]], [[Universal Serial Bus|USB]], [[Ethernet]], [[VME eXtensions for Instrumentation|VXIbus]], [[HiSLIP]], etc.<ref name="IVI-SCPI">{{cite web |title=The SCPI Standard (overview) |url=https://www.ivifoundation.org/About-IVI/scpi.html |website=IVI Foundation |archive-url=https://web.archive.org/web/20240921020849/https://www.ivifoundation.org/About-IVI/scpi.html |archive-date=September 21, 2024 |url-status=live}}</ref>
 
SCPI commands are [[ASCII]] textual strings,<ref name="IVI-SCPI"/> which are sent to the instrument over the physical layer (e.g.,<ref IEEEname="IVI-488.1).SCPI"/> Commands are a series of one or more keywords, many of which take parameters. In the specification, keywords are written <code>CONFigure</CODE>: The entire keyword can be used, or it can be abbreviated to just the uppercase portion. Responses to query commands are typically ASCII strings. However, for bulk data, binary formats can be used.<ref name="SCPI-1999-spec"/>
 
The SCPI specification consists of four volumes: Volume 1: "Syntax and Style", Volume 2: "Command Reference", Volume 3: "Data Interchange Format", Volume 4: "Instrument Classes".<ref name="SCPI-1999-spec"/> The specification was originally released as non-free printed manuals, then later as aone free [[PDF]] file that includes all four volumes.<ref name="SCPI-1999-spec"/>
 
===SCPI history===
Line 40:
:AC?
...
 
===Case===
Though the command syntax above shows commands in mixed case, SCPI is not [[Case sensitivity|case sensitive]].
 
:For example, for <code>VOLTage</code>, all of the following are valid representations:<code>VOLTAGE</code>, <code>voltage</code>, <code>Voltage</code>, <code>VoLtAgE</code>.
 
===Abbreviating commands===
The command syntax shows some characters in a mixture of upper and lower case. Abbreviating the command to only sending the upper case has the same meaning as sending the upper and lower case command.<ref name="SCPI-1999-spec"/>
 
:For example, the command “<code>SYSTem:COMMunicate:SERial:BAUD 2400</code>” would set an RS-232 serial communications interface to 2400 [[Bit rate|bit/s]]. This could also alternatively be abbreviated “<code>SYST:COMM:SER:BAUD 2400</code>”. The query command “<code>SYSTem:COMMunicate:SERial:BAUD?</code>” or “<code>SYST:COMM:SER:BAUD?</code>” would instruct the instrument to report its current baud rate.
 
The only valid commands are the short form and long form of each command, all other subset variations are invalid.
 
:For example, for <code>COMMunicate</code>, only <code>COMM</code> (short form) and <code>COMMUNICATE</code> (long form) are valid, but <code>COM</code>, <code>COMMUN</code>, <code>COMMUNIC</code> subsets are invalid, also appended letters are invalid too, such as <code>COMMUNICATED</code>.
 
=== Concatenating commands ===
Multiple commands can be issued to an instrument in a single string. They are made of simple commands separated by a semicolon character (<code>;</code>).

:For example, the command to "Measure a DC voltage then measure an AC current" would be issued as <code>MEASure:VOLTage:DC?;:MEASure:CURRent:AC?</code>.
 
Simple commands which start with a colon (<code>:</code>) are interpreted with respect to the root of the command tree. Otherwise, they refer implicitly to the last node of the previous command (unless they already begin with an asterisk). For example,
Line 68 ⟶ 79:
* Octal: <code>#Q32</code> or <code>#q32</code>
* Binary: <code>#B11010</code> or <code>#b11010</code>
 
===488.2 commands===
Since SCPI was defined as an additional layer on top of the IEEE 488.2 specification, a SCPI compliant device should recognize various 488.2 commands too.<ref name="SCPI-1999-spec"/> These commands might also be known unofficially as asterisk commands (or star commands), because they start with the [[asterisk]] <code>*</code> character.
 
According to section 4.1.1 of Volume 1 of SCPI, all SCPI devices must implement the following 488.2 commands.<ref name="SCPI-1999-spec"/> In the real world some low-end test equipment may only support a subset of these 488.2 commands, or may even accept the commands but not perform any operation. A user should check the official programmers manual for each device before assuming all of these 488.2 commands are supported.
{{Div col|colwidth=15em}}
* <code>*CLS</code>
* <code>*ESE</code>
* <code>*ESE?</code>
* <code>*ESR?</code>
* <code>*IDN?</code>
* <code>*OPC</code>
* <code>*OPC?</code>
* <code>*RST</code>
* <code>*SRE</code>
* <code>*SRE?</code>
* <code>*STB?</code>
* <code>*TST?</code>
* <code>*WAI</code>
{{Div col end}}
 
According to section 4.1.2 of Volume 1 of SCPI, all other 488.2 commands not listed above are considered optional and not required by SCPI.<ref name="SCPI-1999-spec"/>
{{Div col|colwidth=15em}}
* <code>*AAD</code>
* <code>*CAL?</code>
* <code>*DDT</code>
* <code>*DDT?</code>
* <code>*DLF</code>
* <code>*DMC</code>
* <code>*EMC</code>
* <code>*EMC?</code>
* <code>*GMC?</code>
* <code>*IST?</code>
* <code>*LMC?</code>
* <code>*LRN?</code>
* <code>*OPT?</code>
* <code>*PCB</code>
* <code>*PMC</code>
* <code>*PRE</code>
* <code>*PRE?</code>
* <code>*PSC</code>
* <code>*PSC?</code>
* <code>*PUD</code>
* <code>*PUD?</code>
* <code>*RCL</code>
* <code>*RDT</code>
* <code>*RDT?</code>
* <code>*SAV</code>
* <code>*TRG</code>
* <code>*RMC</code>
* <code>*SDS</code>
{{Div col end}}
 
== See also ==
Line 76 ⟶ 139:
 
==References==
{{Reflist|30em}}
 
==External links==
Line 82 ⟶ 145:
* [https://www.ivifoundation.org/About-IVI/scpi.html SCPI Organization], official website
;Specifications
* [https://www.ivifoundation.org/downloads/SCPI/scpi-99.pdf SCPI-1999, Volume 1-4], 819 page PDF file, '''free''' download ''(doesn't include asterisk (*) commands, because they are specified in IEEE 488.2 & IEC 60488-2)''
* [https://ieeexplore.ieee.org/document/8705775 IEEE 488.2-1992], 254 page PDF file, costs [https://www.techstreet.com/ieee/standards/ieee-488-2-1992?product_id=1888634 USD$5254] in 20242025 ''(replaces [https://www.techstreet.com/ieee/standards/ieee-488-2-1987?product_id=1777534 IEEE 488.2-1987], both superseded by IEEE/IEC 60488-2-2004)''
* [https://ieeexplore.ieee.org/document/1352831 IEEE/IEC 60488-2-2004], 264 page PDF file, costs [https://www.techstreet.com/ieee/standards/ieee-iec-60488-2-2004?product_id=1779348 USD$373388] in 2024 ''(replaces IEC 60625-2-1993 / IEEE 488.2-1992 / IEEE 488.2-1987)''2025
 
===Programming Manual Examples===