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
- Source code: https://github.com/Minu-IU3IRR/PyAR488
- Issue tracker: https://github.com/Minu-IU3IRR/PyAR488/issues
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c822cdea87174adcaf8f8b3f401e9958516b48ae790f0fbede4fb91f97fb5988
|
|
| MD5 |
37e84265264cfefb1d6c00dcf32131b4
|
|
| BLAKE2b-256 |
1146a86c75a708c2d88f5eaa0d76d84965661f8551f1501e7660ff9085a104fe
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f71c7880a95c155f7d2e23558aec33e1110a6a679f409f1ba81cb9533682eeb2
|
|
| MD5 |
a6bb5ab2687faf6886bfa8f76af4069d
|
|
| BLAKE2b-256 |
43aa3c1cc2c7840512c9dc649804b90d09545a255a8f0c5228261ce28a358bbd
|