Skip to content

EDGE_TRIGGER_MSO2X

Download Flojoy Studio to try this app
Set the MSO2XX edge trigger settings. 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). channel : int, default=1 Oscilloscope channel to affect level : float, default=1 The trigger threshold voltage, in V. edge_coupling : select, default=unchanged The type of edge coupling to use for triggering. edge_slope : select, default=unchanged The type of edge slope to use for triggering. Returns: out : String Trigger settings
Python Code
from typing import Optional, Literal
from flojoy import VisaConnection, flojoy, DataContainer, String


@flojoy(deps={"tm_devices": "1"}, inject_connection=True)
def EDGE_TRIGGER_MSO2X(
    connection: VisaConnection,
    input: Optional[DataContainer] = None,
    channel: int = 1,
    level: float = 1.0,
    edge_coupling: Literal[
        "unchanged", "dc", "hfrej", "lfrej", "noiserej"
    ] = "unchanged",
    edge_slope: Literal["unchanged", "rise", "fall", "either"] = "unchanged",
) -> String:
    """Set the MSO2XX edge trigger settings.

    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
    level : float, default=1
        The trigger threshold voltage, in V.
    edge_coupling : select, default=unchanged
        The type of edge coupling to use for triggering.
    edge_slope : select, default=unchanged
        The type of edge slope to use for triggering.

    Returns
    -------
    String
        Trigger settings
    """

    # Retrieve oscilloscope instrument connection
    scope = connection.get_handle()

    if edge_coupling != "unchanged":
        scope.commands.trigger.a.edge.coupling.write(edge_coupling)
    if edge_slope != "unchanged":
        scope.commands.trigger.a.edge.slope.write(edge_slope)
    scope.commands.trigger.a.level.ch[channel].write(level)

    return String(s="Trigger settings")

Find this Flojoy Block on GitHub

Videos

Control Tektronix MSO Oscilloscope with Flojoy

Example App

Having problems with this example app? Join our Discord community and we will help you out!
React Flow mini map

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.