Skip to content

PROLOGIX_ADDR

Download Flojoy Studio to try this app
Set the GPIB address of the Prologix USB-to-GPIB adapter. This setting should match the address for the GPIB instrument. Requires an OPEN_SERIAL block. Params: connection : Serial The open serial connection with the instrument. addr : int The GPIB address. Returns: out : String Response from the Prologix USB-to-GPIB controller.
Python Code
import serial
from flojoy import flojoy, SerialConnection, DataContainer, String
from typing import cast, Optional


@flojoy(inject_connection=True)
def PROLOGIX_ADDR(
    connection: SerialConnection,
    default: Optional[DataContainer] = None,
    addr: int = 10,
) -> String:
    """Set the GPIB address of the Prologix USB-to-GPIB adapter.

    This setting should match the address for the GPIB instrument.

    Requires an OPEN_SERIAL block.

    Parameters
    ----------
    connection: Serial
        The open serial connection with the instrument.
    addr: int
        The GPIB address.

    Returns
    -------
    String
        Response from the Prologix USB-to-GPIB controller.
    """

    # Start serial communication with the instrument
    ser = cast(serial.Serial, connection.get_handle())

    if ser is None:
        raise ValueError("Serial communication is not open")

    cmd = "++addr " + str(addr) + "\n"
    ser.write(cmd.encode())

    s = ser.read(256)

    return String(s)

Find this Flojoy Block on GitHub

Videos

Control Agilent 34410A multimeter with Flojoy

Example App

Having problems with this example app? Join our Discord community and we will help you out!
React Flow mini map

This app prepares the Prologix GPIB-USB adapter for use with a VISA instrument. The user can then send a SCPI command to a VISA instrument using the GPIB-USB adapter.

Parameters:

  • Connection on all of the Blocks should be the COM port of the adapter.
  • PROLOGIX AUTO: auto = off
  • PROLOGIX MODE: mode = CONTROLLER
  • PROLOGIX EOI: EOI = true, EOS = None (instrument dependent)
  • GPIB address should match the instrument’s (see the instrument’s manual on how to find it)
  • OPEN SERIAL: writing “*IDN?” with bytes encoding and a LF terminator

This app has two rows that are run seperately:

  1. The top, setup, row with AUTO, MODE and EOI blocks.
  2. The bottom row with WRITE and READ.

The two constants on the bottom left control which row runs. If they are equal, the setup row runs. Otherwise, the read/write row runs. The setup should be run before connecting the adapter to the instrument.

Note that the PROLOGIX READ should be used to recieve a response from the instrument. The AUTO mode can be turned on which recieves a response upon every command (PROLOGIX AUTO block controls this setting). However, this causes errors in some VISA instruments.