SETUP_FILE_MSO2X
Saves or recalls a instrument setup file (.set). The file currently can only be located in the instruments C drive (C:/)
Requires a CONNECT_MSO2X block to create the connection.
Tested on MSO22 and MSO24. Params: connection : VisaConnection The VISA address (requires the CONNECTION_MSO2X block). save_or_recall : select, default=save Save or recall the file. filename : str, default=flojoy The file name to save or recall ("flojoy" results in "C:/flojoy.set"). Returns: out : String Filename
Python Code
from typing import Optional, Literal
from flojoy import VisaConnection, flojoy, String, DataContainer
@flojoy(deps={"tm_devices": "1"}, inject_connection=True)
def SETUP_FILE_MSO2X(
connection: VisaConnection,
save_or_recall: Literal["save", "recall"] = "save",
filename: str = "flojoy",
input: Optional[DataContainer] = None,
) -> String:
"""Saves or recalls a instrument setup file (.set).
The file currently can only be located in the instruments C drive (C:/)
Requires a CONNECT_MSO2X block to create the connection.
Tested on MSO22 and MSO24.
Parameters
----------
connection : VisaConnection
The VISA address (requires the CONNECTION_MSO2X block).
save_or_recall : select, default=save
Save or recall the file.
filename : str, default=flojoy
The file name to save or recall ("flojoy" results in "C:/flojoy.set").
Returns
-------
String
Filename
"""
# Retrieve oscilloscope instrument connection.
scope = connection.get_handle()
if save_or_recall == "save":
scope.commands.save.setup.write(f"c:/{filename}.set")
elif save_or_recall == "recall":
scope.commands.recall.setup.write(f'"c:/{filename}.set"')
return String(s=f"{filename}")
Videos
Control Tektronix MSO Oscilloscope with Flojoy
Example
Having problems with this example app? Join our Discord community and we will help you out!
This app uses the Tektronix tm_measure library to load a setup file and extract curves from a Tektronix MSO24 oscilloscope.
A setup file in MSO24 can store most of the instruments settings including axis scales, trigger settings, etc. The settings must already be stored for this example app.
First the necessary blocks were added:
- 1
CONNECT_MSO2X
- 1
SETUP_FILE_MSO2X
- 1
AFG_MSO2X
- 3
QUERY_CURVE_MSO2X
- 3
LINE
Each of these blocks must change the connection
parameter to the correct instrument. The SETUP_FILE_MSO2X
can be set to recall flojoy
as a filename (this recalls the file located at c:/flojoy.set
).
The three QUERY_CURVE_MSO2X
blocks were set to channel 1, 2, and 3 (one each).
Note that the AFG settings are not loaded from the setup file. Note two inputs (CH2 and CH3) came from an external source.