Skip to content

SAVE_STATE_AFG31000

Download Flojoy Studio to try this app
Saves or recalls the state for the AFG31000. The channel output state is not save (i.e. if the channel was outputing). This block should also work with compatible Tektronix AFG31XXX instruments. Params: connection : VisaConnection The VISA address (requires the CONNECTION_AFG31000 block). save_recall : select, default=save Save or recall the save state. option : select, default=1 Choose from the 5 save states. Returns: out : String Save state
Python Code
from flojoy import flojoy, DataContainer, String, VisaConnection
from typing import Optional, Literal


@flojoy(inject_connection=True)
def SAVE_STATE_AFG31000(
    connection: VisaConnection,
    save_recall: Literal["save", "recall"] = "save",
    option: Literal["1", "2", "3", "4", "5"] = "1",
    input: Optional[DataContainer] = None,
) -> String:
    """Saves or recalls the state for the AFG31000.

    The channel output state is not save (i.e. if the channel was outputing).

    This block should also work with compatible Tektronix AFG31XXX instruments.

    Parameters
    ----------
    connection: VisaConnection
        The VISA address (requires the CONNECTION_AFG31000 block).
    save_recall: select, default=save
        Save or recall the save state.
    option: select, default=1
        Choose from the 5 save states.

    Returns
    -------
    String
        Save state
    """

    afg = connection.get_handle()

    if save_recall == "save":
        afg.write(f"*SAV {option}")
    else:
        afg.write(f"*RCL {option}")

    return String(s=f"Save state {option}")

Find this Flojoy Block on GitHub

Videos

Control the AFG31000 Function Generator with Flojoy

Example App

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

In this example, an Tektronix AFG31000 is used to generate two waveforms.

First the necessary blocks were added:

  • CONNECT_AFG31000
  • RESET_AFG31000
  • 2x FUNCTION_AFG31000
  • ALIGN_PHASES_AFG31000
  • OUTPUT_AFG31000
  • SAVE_STATE_AFG31000

The instrument address was set for each AFG31000 block. Ensure the OUTPUT_AFG31000 block has both channels turn on.

The blocks were connected as shown and the app was run. The SAVE_STATE_AFG31000 block can be used to save and recall the current state of the AFG. However, you must use a OUTPUT_AFG31000 block to turn the outputs back on.

An oscilloscope was connected to the AFG31000 resulting in waveform:

image