Skip to main content

module to interface AR488 boards

Project description

PyAR488

PyAR488 is a Python package to interact with AR488 GPIB-USB interface boards.
It provides a thin abstraction layer over the serial interface to simplify communication with GPIB instruments.


Installation

pip install PyAR488

Requirements

  • Python 3.6+
  • pyserial (installed automatically as a dependency)

Quickstart

from PyAR488.PyAR488 import AR488

# Open the interface (replace COM5 with your serial port)
interface = AR488("COM5")

# Set GPIB address and read
interface.address(22)
print(interface.read())

Using PyAR488 in Custom Instrument Classes

A recommended pattern is to inject the AR488 interface into your instrument classes:

from PyAR488.PyAR488 import AR488

class HP3468A:
    def __init__(self, gpib_address: int, interface: AR488):
        self.address = gpib_address
        self.interface = interface

    def read_measurement(self):
        self.interface.address(self.address)
        return self.interface.read()

interface = AR488("COM5")
meter = HP3468A(22, interface)

reading = meter.read_measurement()
print(reading)

Safer Pattern: Enforcing Address Before Each Operation

If multiple instruments share the same interface, ensure the GPIB address is set before every read/write:

class MyInstrument:
    def __init__(self, interface: AR488, address: int):
        self.interface = interface
        self.address = address

    def read(self, message: str = ""):
        self.interface.address(self.address)
        return self.interface.read(message)

This prevents accidental cross-talk when the interface address is changed elsewhere in your code.


Debugging

Enable debug mode to print communication traffic:

interface = AR488("COM5", debug=True)

Support

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyar488-1.7.2.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyar488-1.7.2-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

Details for the file pyar488-1.7.2.tar.gz.

File metadata

  • Download URL: pyar488-1.7.2.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for pyar488-1.7.2.tar.gz
Algorithm Hash digest
SHA256 c822cdea87174adcaf8f8b3f401e9958516b48ae790f0fbede4fb91f97fb5988
MD5 37e84265264cfefb1d6c00dcf32131b4
BLAKE2b-256 1146a86c75a708c2d88f5eaa0d76d84965661f8551f1501e7660ff9085a104fe

See more details on using hashes here.

File details

Details for the file pyar488-1.7.2-py3-none-any.whl.

File metadata

  • Download URL: pyar488-1.7.2-py3-none-any.whl
  • Upload date:
  • Size: 8.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for pyar488-1.7.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f71c7880a95c155f7d2e23558aec33e1110a6a679f409f1ba81cb9533682eeb2
MD5 a6bb5ab2687faf6886bfa8f76af4069d
BLAKE2b-256 43aa3c1cc2c7840512c9dc649804b90d09545a255a8f0c5228261ce28a358bbd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page