PROLOGIX_AUTO
Toggle "Read-After-Write" mode on or off for the USB-to-GPIB adapter. When Read-After-Write is on, the Prologix USB-to-GPIB controller
automatically reads a bench-top instrument's response after writing a
command to it.
Requires an OPEN_SERIAL block. Params: connection : Serial The open serial connection with the instrument. auto : select Use the read-after-write mode or not. 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_AUTO(
connection: SerialConnection,
default: Optional[DataContainer] = None,
auto: Literal["On", "Off", "Current state"] = "Current state",
) -> String:
"""Toggle "Read-After-Write" mode on or off for the USB-to-GPIB adapter.
When Read-After-Write is on, the Prologix USB-to-GPIB controller
automatically reads a bench-top instrument's response after writing a
command to it.
Requires an OPEN_SERIAL block.
Parameters
----------
connection: Serial
The open serial connection with the instrument.
auto: select
Use the read-after-write mode or not.
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")
auto_integer = 0
if auto == "Current state":
ser.write(b"++auto\n")
elif auto == "On":
auto_integer = 1
else:
cmd = "++auto " + str(auto_integer) + "\n"
ser.write(cmd.encode())
s = ser.read(256)
return String(s)
Videos
Control Agilent 34410A multimeter with Flojoy
Example
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 = offPROLOGIX MODE
: mode = CONTROLLERPROLOGIX 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
,MODE
andEOI
blocks. - The bottom row with
WRITE
andREAD
.
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.