PROLOGIX_EOI
Download Flojoy Studio to try this app
  
 Sets the EOI and EOS settings for the Prologix GPIB-USB adapter. Only used for the GPIB port (not the serial port). These settings depend on
the instrument you are using.
EOI - end of interrupt (use terminator or not)
EOS - end of string (termination character)
Requires an OPEN_SERIAL block.  Params:    connection : Serial  The open serial connection with the instrument.   eoi : bool  Use EOI (1) or not (0).   eos : select  Which terminator to use.     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, Literal
@flojoy(inject_connection=True)
def PROLOGIX_EOI(
    connection: SerialConnection,
    default: Optional[DataContainer] = None,
    eoi: bool = True,
    eos: Literal["CR+LF", "CR", "LF", "None"] = "None",
) -> String:
    """Sets the EOI and EOS settings for the Prologix GPIB-USB adapter.
    Only used for the GPIB port (not the serial port). These settings depend on
    the instrument you are using.
    EOI - end of interrupt (use terminator or not)
    EOS - end of string (termination character)
    Requires an OPEN_SERIAL block.
    Parameters
    ----------
    connection: Serial
        The open serial connection with the instrument.
    eoi: bool
        Use EOI (1) or not (0).
    eos: select
        Which terminator to use.
    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")
    if eoi:
        cmd = 1
    else:
        cmd = 0
    match eos:
        case "CR+LF":
            eos = 0
        case "CR":
            eos = 1
        case "LF":
            eos = 2
        case "None":
            eos = 3
    ser.write(str(cmd).encode())
    cmd = f"++eos {eos}\n"
    ser.write(cmd.encode())
    s = ser.read(256)
    return String(s)
Example App
Having problems with this example app? Join our Discord community and we will help you out!
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:
- The top, setup, row with AUTO,MODEandEOIblocks.
- The bottom row with WRITEandREAD.
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.