ug-gpib


Nameug-gpib JSON
Version 1.2.0 PyPI version JSON
download
home_page
SummaryA Python3 pyUSB library for the LQ Electronics Corp. UGPlus USB to GPIB Controller.
upload_time2023-03-10 15:24:40
maintainer
docs_urlNone
author
requires_python>=3.7
licenseGNU General Public License v3 (GPLv3)
keywords ugplus gpib api
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # ug_gpib
A Python3 pyUSB driver for the LQ Electronics Corp UGPlus USB to GPIB Controller.

Tested using Linux, should work for Mac OSX, Windows and any OS with Python [pyUSB](https://github.com/pyusb/pyusb)
support.

:warning: **The device must be IEEE 488.1 compliant. It must assert the EOI line to signal the end of a line. If this is
not the case, the controller cannot be used. Older devices, typically only send CR, LF, or CR-LF.**

The [UGPlus](http://lqelectronics.com/Products/USBUG/UGPlus/UGPlus.html) is a fairly cheap controller, that supports
simple GPIB read and write operations only. It does not support advanced GPIB features like serial polling for example,
and it does not have line drivers to support long cables and lots of devices on the bus.

The UGPlus does have several firmware bugs, I have tried to mitigate them to the best of my knowledge. See
[below](#firmware-bugs) for details.

If you are looking for advanced features I suggest buying either a Prologix GPIB adapter or one of the NI USB adapters.
I can recommend the following libraries for both
[Prologix GPIB adapter](https://github.com/PatrickBaus/pyAsyncPrologixGpib) and
[Linux GPIB](https://github.com/PatrickBaus/pyAsyncGpib).

## Setup

To install the library in a virtual environment (always use venvs with every project):

```bash
virtualenv env  # virtual environment, optional
source env/bin/activate
pip install ug-gpib
```

### Linux
To access the raw usb port in Linux, root privileges are required. It is possible to use udev to change ownership of the
usb port on creation. This can be done via a rules file.

```bash
sudo cp 98-ugsimple.rules /etc/udev/rules.d/.
sudo udevadm control --reload-rules
```

## Usage

Initialize UGSimpleGPIB

```python
from ug_gpib import UGPlusGpib

gpib_controller = UGPlusGpib()
```

Writing "*IDN?" a command to address 0x02. Do note the GPIB commands must be byte strings.
```python
gpib_controller.write(2, b"*IDN?\n")
```

Reading from address 0x02 and decoding the byte string to a unicode string.
```python
data = gpib_controller.read(2)
print(data.decode())
```

See [examples/](examples/) for more working examples. Including an example that shows how to use the library from the
command line.

## Firmware Bugs
There are several bugs in the firmware of the UGPlus most of those are off-by-one errors and consequently out-of-bounds
reads. I documented them
[here](https://github.com/PatrickBaus/pyUgGpib/blob/f1bb0d2244304b3e3f9776606918eaa270d0e9dc/ug_gpib/ug_gpib.py#L152).
Some of these bugs are also evident when using the software supplied by the manufacturer.
The most obvious ones are the following:

* Out-of-bounds read when reading the firmware version. The controller sends one more byte than requested.
* Out-of-bounds read when discovering GPIB devices. The controller sends one more byte than requested.
* Out-of-bounds read when the GPIB device does not return any data. The controller sends one more byte than requested.

## Versioning

I use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/PatrickBaus/pyAsyncPrologix/tags). 

## Documentation
I use the [Numpydoc](https://numpydoc.readthedocs.io/en/latest/format.html) style for documentation.

## Authors

* **Jacob Alexander** - *Initial work for the UGSimple* [Jacob Alexander](https://github.com/haata)
* **Patrick Baus** - *Complete rewrite for the UGPlus* - [PatrickBaus](https://github.com/PatrickBaus)

## License


This project is licensed under the GPL v3 license - see the [LICENSE](LICENSE) file for details

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "ug-gpib",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "UGPlus,GPIB,API",
    "author": "",
    "author_email": "Patrick Baus <patrick.baus@physik.tu-darmstadt.de>, Jacob Alexander <haata@kiibohd.com>",
    "download_url": "https://files.pythonhosted.org/packages/f6/b1/3ce10bf7a466e826cc7bd72751a88b242e0acbc5da0feffd3c4ca6bbfd3e/ug_gpib-1.2.0.tar.gz",
    "platform": null,
    "description": "# ug_gpib\nA Python3 pyUSB driver for the LQ Electronics Corp UGPlus USB to GPIB Controller.\n\nTested using Linux, should work for Mac OSX, Windows and any OS with Python [pyUSB](https://github.com/pyusb/pyusb)\nsupport.\n\n:warning: **The device must be IEEE 488.1 compliant. It must assert the EOI line to signal the end of a line. If this is\nnot the case, the controller cannot be used. Older devices, typically only send CR, LF, or CR-LF.**\n\nThe [UGPlus](http://lqelectronics.com/Products/USBUG/UGPlus/UGPlus.html) is a fairly cheap controller, that supports\nsimple GPIB read and write operations only. It does not support advanced GPIB features like serial polling for example,\nand it does not have line drivers to support long cables and lots of devices on the bus.\n\nThe UGPlus does have several firmware bugs, I have tried to mitigate them to the best of my knowledge. See\n[below](#firmware-bugs) for details.\n\nIf you are looking for advanced features I suggest buying either a Prologix GPIB adapter or one of the NI USB adapters.\nI can recommend the following libraries for both\n[Prologix GPIB adapter](https://github.com/PatrickBaus/pyAsyncPrologixGpib) and\n[Linux GPIB](https://github.com/PatrickBaus/pyAsyncGpib).\n\n## Setup\n\nTo install the library in a virtual environment (always use venvs with every project):\n\n```bash\nvirtualenv env  # virtual environment, optional\nsource env/bin/activate\npip install ug-gpib\n```\n\n### Linux\nTo access the raw usb port in Linux, root privileges are required. It is possible to use udev to change ownership of the\nusb port on creation. This can be done via a rules file.\n\n```bash\nsudo cp 98-ugsimple.rules /etc/udev/rules.d/.\nsudo udevadm control --reload-rules\n```\n\n## Usage\n\nInitialize UGSimpleGPIB\n\n```python\nfrom ug_gpib import UGPlusGpib\n\ngpib_controller = UGPlusGpib()\n```\n\nWriting \"*IDN?\" a command to address 0x02. Do note the GPIB commands must be byte strings.\n```python\ngpib_controller.write(2, b\"*IDN?\\n\")\n```\n\nReading from address 0x02 and decoding the byte string to a unicode string.\n```python\ndata = gpib_controller.read(2)\nprint(data.decode())\n```\n\nSee [examples/](examples/) for more working examples. Including an example that shows how to use the library from the\ncommand line.\n\n## Firmware Bugs\nThere are several bugs in the firmware of the UGPlus most of those are off-by-one errors and consequently out-of-bounds\nreads. I documented them\n[here](https://github.com/PatrickBaus/pyUgGpib/blob/f1bb0d2244304b3e3f9776606918eaa270d0e9dc/ug_gpib/ug_gpib.py#L152).\nSome of these bugs are also evident when using the software supplied by the manufacturer.\nThe most obvious ones are the following:\n\n* Out-of-bounds read when reading the firmware version. The controller sends one more byte than requested.\n* Out-of-bounds read when discovering GPIB devices. The controller sends one more byte than requested.\n* Out-of-bounds read when the GPIB device does not return any data. The controller sends one more byte than requested.\n\n## Versioning\n\nI use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/PatrickBaus/pyAsyncPrologix/tags). \n\n## Documentation\nI use the [Numpydoc](https://numpydoc.readthedocs.io/en/latest/format.html) style for documentation.\n\n## Authors\n\n* **Jacob Alexander** - *Initial work for the UGSimple* [Jacob Alexander](https://github.com/haata)\n* **Patrick Baus** - *Complete rewrite for the UGPlus* - [PatrickBaus](https://github.com/PatrickBaus)\n\n## License\n\n\nThis project is licensed under the GPL v3 license - see the [LICENSE](LICENSE) file for details\n",
    "bugtrack_url": null,
    "license": "GNU General Public License v3 (GPLv3)",
    "summary": "A Python3 pyUSB library for the LQ Electronics Corp. UGPlus USB to GPIB Controller.",
    "version": "1.2.0",
    "split_keywords": [
        "ugplus",
        "gpib",
        "api"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "da888d57b9ecaa7118a33011a1a56216ef11bb33a5b3064dc01dec7915774dd5",
                "md5": "89cd19eac8717f8ea0581df31baa14e2",
                "sha256": "31210a2ed58c1b25d5611b4dade899abbbc44b1227690cff49aab69a639c677d"
            },
            "downloads": -1,
            "filename": "ug_gpib-1.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "89cd19eac8717f8ea0581df31baa14e2",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 21284,
            "upload_time": "2023-03-10T15:24:39",
            "upload_time_iso_8601": "2023-03-10T15:24:39.126825Z",
            "url": "https://files.pythonhosted.org/packages/da/88/8d57b9ecaa7118a33011a1a56216ef11bb33a5b3064dc01dec7915774dd5/ug_gpib-1.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f6b13ce10bf7a466e826cc7bd72751a88b242e0acbc5da0feffd3c4ca6bbfd3e",
                "md5": "27d1e82e280ea44d357a2cc7cacb6b10",
                "sha256": "541016f603d54d5f18a1e73d695f3f23045e37cef5df4f775c4ed37fa7661bb8"
            },
            "downloads": -1,
            "filename": "ug_gpib-1.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "27d1e82e280ea44d357a2cc7cacb6b10",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 22642,
            "upload_time": "2023-03-10T15:24:40",
            "upload_time_iso_8601": "2023-03-10T15:24:40.306804Z",
            "url": "https://files.pythonhosted.org/packages/f6/b1/3ce10bf7a466e826cc7bd72751a88b242e0acbc5da0feffd3c4ca6bbfd3e/ug_gpib-1.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-03-10 15:24:40",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "ug-gpib"
}
        
Elapsed time: 0.05145s