Skip to content
This repository has been archived by the owner on Nov 24, 2023. It is now read-only.

[WIP] Scpi gpib can - nodes PR:327 #441

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
The CAN_MESSAGE node sends a message onto CAN network through a slcan-compatible USB-to-CAN adapter.

Inputs
------
default: Vector
The array of data to send to the CAN bus.

Parameters
----------
arbitration_id:
Unique ID for message being sent.
is_extended_id: bool
Flag that controls the size of the arbitration_id field.

Returns
-------
None
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
The PROLOGIX_ADDR node sets the GPIB address of an instrument using the Prologix USB-to-GPIB or USB-to-Ethernet adapter.

Inputs
------
default: DataContainer
Any DataContainer - likely connected to the output of the OPEN_SERIAL node.

Parameters
----------
connection: Serial
The open serial connection with the instrument.

Returns
-------
TextBlob
Response from the Prologix USB-to-GPIB controller.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
The PROLOGIX_AUTO node toggles "Read-After-Write" mode on or off.

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.

Inputs
------
default: DataContainer
Any DataContainer - likely connected to the output of the OPEN_SERIAL node.

Parameters
----------
connection: Serial
The open serial connection with the instrument.

Returns
-------
TextBlob
Response from the Prologix USB-to-GPIB controller.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
The PROLOGIX_HELP command returns a list of available Prologix USB-to-GPIB firmware commands.

Inputs
------
default: DataContainer
Any DataContainer - likely connected to the output of the OPEN_SERIAL node.

Parameters
----------
connection: Serial
The open serial connection with the instrument.

Returns
-------
TextBlob
A list of available Prologix USB-to-GPIB firmware commands
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
The PROLOGIX_MODE node sets the mode of the Prologix USB-to-GPIB controller - 1 for CONTROLLER mode and 0 for DEVICE mode.

From the Prologix manual:

In Controller mode, the GPIB-USB Controller acts as the Controller-In-Charge (CIC)
on the GPIB bus. When the controller receives a command over the USB port
terminated by the USB terminator – CR (ASCII 13) or LF (ASCII 10) – it addresses the
GPIB instrument at the currently specified address (See ++addr command) to listen, and
passes along the received data.

In Device mode, Prologix GPIB-USB Controller acts as another peripheral on the GPIB
bus. In this mode, the controller can act as a GPIB TALKER or GPIB LISTENER
only. Since Prologix GPIB-USB Controller is not the Controller-In-Charge while in this
mode, it expects to receive commands from a GPIB controller. When Device mode is
enabled Prologix GPIB-USB controller configures itself as a GPIB Listener. All data
received by the controller over the GPIB port is passed along to the USB port without
buffering.

Inputs
------
default: DataContainer
Any DataContainer - likely connected to the output of the OPEN_SERIAL node.

Parameters
----------
connection: Serial
The open serial connection with the instrument.

Returns
-------
TextBlob
Response from the Prologix USB-to-GPIB controller.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
The PROLOGIX_VER command queries the Prologix USB-to-GPIB firmware version.

Inputs
------
default: DataContainer
Any DataContainer - likely connected to the output of the OPEN_SERIAL node.

Parameters
----------
connection: Serial
The open serial connection with the instrument.

Returns
-------
TextBlob
The Prologix controller available commands.
16 changes: 16 additions & 0 deletions docs/nodes/IO/PROTOCOLS/SCPI/SCPI_WRITE/a1-[autogen]/docstring.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
The SCPI_WRITE node writes a SCPI command to a connected bench-top instrument and returns the result.

Inputs
------
default: DataContainer
Any DataContainer - likely connected to the output of the OPEN_SERIAL node.

Parameters
----------
connection: Serial
The open serial connection with the instrument.

Returns
-------
Scalar|TextBlob
The return value from the bench-top instrument as a Scalar or TextBlob.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"description": null,
"parameters": [
{
"name": "device",
"type": "Serial",
"description": "The connected serial device."
}
],
"returns": [
{
"name": null,
"type": "TextBlob",
"description": null
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,7 @@ from flojoy.connection_manager import DeviceConnectionManager

@flojoy(deps={"pyserial": "3.5"})
def OPEN_SERIAL(device: SerialDevice, baudrate: int = 9600) -> TextBlob:
"""The OPEN_SERIAL node opens a serial connection through your computer's USB or RS-232 port.
Parameters
----------
device: Serial
The connected serial device.
Returns
-------
TextBlob
"""


ser = serial.Serial(
port=device.get_port(),
Expand All @@ -27,4 +19,4 @@ def OPEN_SERIAL(device: SerialDevice, baudrate: int = 9600) -> TextBlob:

DeviceConnectionManager.register_connection(device, ser)

return TextBlob(text_blob=json.dumps(ser.get_settings()))
return TextBlob(text_blob=json.dumps(ser.get_settings()))
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"description": null,
"parameters": [
{
"name": "baudrate",
"type": "int",
"description": "Baud rate for the serial communication."
},
{
"name": "comport",
"type": "string",
"description": "Defines the comunication port on which the serial device is connected."
}
],
"returns": []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"description": null,
"parameters": [
{
"name": "num_readings",
"type": "int",
"description": "Number of points to record."
},
{
"name": "record_period",
"type": "float",
"description": "Length between two recordings in seconds."
},
{
"name": "baudrate",
"type": "int",
"description": "Baud rate for the serial device."
},
{
"name": "comport",
"type": "string",
"description": "COM port of the serial device."
},
{
"name": "num_readings * record_period",
"type": "",
"description": "Is roughly the run length in seconds."
}
],
"returns": []
}
Loading