ProtoCore v0.0.1
Deterministic, zero-heap network stack for embedded targets
Loading...
Searching...
No Matches
scpi.h File Reference

SCPI / IEEE 488.2 instrument-control codec (PC_ENABLE_SCPI) - a zero-heap codec for the text command language nearly every modern bench instrument speaks (DMMs, oscilloscopes, power supplies, function/arbitrary generators, SMUs, spectrum/network analyzers, loads) over a raw TCP socket on port 5025 (also USBTMC / VXI-11 / HiSLIP / serial). More...

#include "protocore_config.h"

Go to the source code of this file.

Detailed Description

SCPI / IEEE 488.2 instrument-control codec (PC_ENABLE_SCPI) - a zero-heap codec for the text command language nearly every modern bench instrument speaks (DMMs, oscilloscopes, power supplies, function/arbitrary generators, SMUs, spectrum/network analyzers, loads) over a raw TCP socket on port 5025 (also USBTMC / VXI-11 / HiSLIP / serial).

The codec is symmetric - it serves both roles:

  • Controller (device drives an instrument): build command lines with a :-hierarchy header and comma-separated parameters (pc_scpi_build), and parse the instrument's replies - numeric NR1/NR2/NR3 (pc_scpi_parse_number), boolean (pc_scpi_parse_bool), quoted string (pc_scpi_parse_string), and the IEEE 488.2 arbitrary block #<n><len><data> used for waveform captures (pc_scpi_parse_block).
  • Instrument (device answers a controller): the IEEE 488.2 status model - the Status Byte, Standard Event Status Register + its enable mask, the Service Request Enable mask, and the SCPI error/event queue (ScpiStatus) - plus a SCPI short/long-form header matcher (pc_scpi_match) to dispatch an incoming command against a pattern like "SYSTem:ERRor?".

Common commands (pc_scpi_common) return the IEEE 488.2 mnemonics (*IDN?, *RST, *CLS, *ESR?, *STB?, ...). Pure codec, host-tested; the TCP/USB/serial transport is the app's.

References:

  • IEEE Std 488.2-1992 (Codes, Formats, Protocols and Common Commands).
  • SCPI Consortium, "Standard Commands for Programmable Instruments", Vol. 1 Syntax & Style (1999).
Author
Douglas Quigg (dstroy0)
Date
2026

Definition in file scpi.h.