S Groesz 97a632435d fix: compute instrument read timeout before sending the read command
The previous fix computed the host-side wait (via a read_tmo_ms query)
after already sending "++read eoi" -- but the controller doesn't answer
any further command while that read is outstanding, so the read_tmo_ms
query itself raced the read it was meant to be timing and could time
out. Reordered so the timeout is resolved first in both query() and
read(); added a regression test pinning the wire ordering.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-24 18:55:26 -05:00
2026-08-24 16:45:12 -05:00
2020-11-10 01:47:47 +00:00
2024-02-07 23:01:18 -06:00
2021-04-17 01:21:54 +00:00

progpib

A modern Python 3 API for the Prologix GPIB-ETHERNET controller. GPIB-USB is supported behind the same interface but is untested -- no GPIB-USB hardware was available while building this package (see progpib/transport/serial.py).

Install (development)

This package depends on bits (distribution name binary-bits), currently used as a local editable checkout rather than a pinned PyPI release -- install it first:

python -m venv .venv
.venv/bin/pip install -e ../bits
.venv/bin/pip install -e .[dev]

Usage

from progpib import discover, GpibController

# Find controllers on the LAN (broadcasts on every local interface):
for device in discover():
    print(device.mac_str, device.ip_address, device.name)

# Talk to one:
with GpibController.ethernet("192.168.1.50") as gpib:
    print(gpib.ver())
    gpib.addr = 5  # address the instrument at GPIB primary address 5
    gpib.eos = 3   # no GPIB terminator appended
    gpib.eoi = 1
    response = gpib.query("*IDN?")
    print(response.decode())

CLI

progpib discover                      # find controllers on the LAN
progpib info <ip>                     # controller version/mode/config
progpib config --mac AA:BB:CC:DD:EE:FF --dhcp
progpib config --mac AA:BB:CC:DD:EE:FF --static 192.168.1.50 255.255.255.0 192.168.1.1
progpib terminal <ip> --addr 5        # interactive pass-through terminal

Reference material

vendortools/, pty-gpib-emulator/, sampledata.txt and PrologixGpibEthernetManual.pdf are kept as historical/reference material (original vendor tooling, a separate PTY-based emulator side project, and a captured protocol session) -- nothing in progpib/ imports from them.

Description
Prologix GPIB python tools.
Readme MIT 304 KiB
Languages
Python 91.2%
C++ 8%
Makefile 0.6%
Shell 0.2%