PROBE_ATTENUATION_MSO2X
Python Code
from typing import Optional
from flojoy import VisaConnection, flojoy, DataContainer, String
@flojoy(deps={"tm_devices": "1"}, inject_connection=True)
def PROBE_ATTENUATION_MSO2X(
connection: VisaConnection,
input: Optional[DataContainer] = None,
channel: int = 1,
attenuation: float = 1.0,
) -> String:
"""Set the MSO2XX probe attenuation for specific channel.
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).
channel : int, default=1
Oscilloscope channel to affect
attenuation : float, default=1
The attenuation level to set
Returns
-------
String
Attenuation
"""
# Retrieve oscilloscope instrument connection
scope = connection.get_handle()
scope.set_and_check(f":CH{channel}:PROBEFunc:EXTAtten", attenuation)
return String(s="Attenuation")
Example App
This app uses the Tektronix tm_measure library to create a steup file for a Tektronix MSO24 oscilloscope.
A setup file in MSO24 can store most of the instruments settings including axis scales, trigger settings, etc. To store the settings Flojoy blocks must first be used to create the inital settings.
First the necessary blocks were added:
- 1
CONNECT_MSO2X
- 1
AFG_MSO2X
- 1
CHANNEL_DISPLAY_MSO2X
- 1
EDGE_TRIGGER_MSO2X
- 1
HORIZONTAL_SCALE_MSO2X
- 3
VERTICAL_SCALE_MSO2X
- 3
PROBE_ATTENUATION_MSO2X
- 1
SETUP_FILE_MSO2X
Each of these blocks must change the connection
parameter to the correct instrument. The channel
parameter for the 3 VERTICAL_SCALE_MSO2X
blocks must be changed to channel 1, 2, and 3 (i.e. one each). The same is true for PROBE_ATTENUATION_MSO2X
. Additionally the three channels can be turned on with the CHANNEL_DISPLAY_MSO2X
block.
The SETUP_FILE_MSO2X
can be set to save flojoy
as a filename (this saves the file located at c:/flojoy.set
).
Note that the AFG settings are not loaded from the setup file. Note two inputs (CH2 and CH3) came from an external source.