|
ProtoCore v0.0.1
Deterministic, zero-heap network stack for embedded targets
|
Layer: L7 Application ยท Build flags: PC_ENABLE_GPIB
A huge installed base of bench instruments speaks only IEEE-488 (GPIB) and will never talk SCPI-over-TCP directly. A Prologix GPIB-Ethernet adapter bridges them onto the LAN: you open a raw TCP socket (port 1234) and speak the Prologix ++ command language. services/gpib is a pure codec for that command set; the sketch owns the socket.
A line starting with ++ is a controller command; anything else is data forwarded over GPIB to the addressed instrument. Configure the adapter, then send SCPI as data:
The data escaping is the subtle part: each CR / LF / ESC / + byte in the payload is preceded by an ESC (27) so it is not eaten as a line terminator or mistaken for a command - verified byte-exact against the Prologix manual's binary example. Response parsers cover the serial-poll status byte (pc_gpib_parse_decimal after ++spoll), the address, and the ++ver string.
Point ADAPTER_IP at a Prologix GPIB-Ethernet controller (or an AR488-Ethernet build) with a GPIB instrument at INSTRUMENT_ADDR. No adapter handy? A Prologix-emulating socket server on a host works for a dry run.
Flash and watch Serial @ 115200:
The complete sketch is Gpib.ino. The codec itself is in src/services/instrumentation/gpib/gpib.h; the command set, the ++eos mapping, the data-escaping rule, and the TCP port are verified against the Prologix GPIB-Ethernet and GPIB-USB controller manuals (cross-checked with AR488).