Main Content

Generate Standard Waveforms Using the Quick-Control Function Generator

This example shows how to use the Quick-Control Function Generator to generate a standard waveform. To generate an arbitrary waveform, see Generate Arbitrary Waveforms Using Quick-Control Function Generator. Quick-Control Function Generator works with any function generator using an IVI-C driver as long as the instrument and the driver support the functionality. You can follow the basic steps using your particular function generator. This example uses Keysight® VISA, but you can use any vendor's implementation of VISA.

In this example, an electronic test engineer wants to create a simple sine waveform to test the clock operating range of a digital circuit.

  1. Ensure all necessary software is installed. See Quick-Control Function Generator Requirements for the list.

  2. Create an instance of the function generator.

    % Instantiate an instance of the fgen.
    myFGen = fgen();
  3. Discover available resources. A resource string is an identifier to the instrument. You must set it before connecting to the instrument.

    % Find resources.
    availableResources = resources(myFGen)

    This returns a resource string or an array of resource strings, for example:

    ans =
  4. Set the resource for the function generator you want to communicate with.

    myFGen.Resource = 'GPIB0::10::INSTR';
  5. Connect to the function generator.

  6. Specify the channel name from which the function generator produces the waveform.

    selectChannel(myFGen, '1');
  7. Configure the function generator.

    You can configure any of the instrument’s properties that are settable. Configure the waveform to be a continuous sine wave and then configure various settings as shown.

    % Set the type of waveform to a sine wave.
    myFGen.Waveform = 'sine';
    % Set the output mode to continuous. 
    myFGen.Mode = 'continuous';
    % Set the load impedance to 50 Ohms. 
    myFGen.OutputImpedance = 50;
    % Set the frequency to 2500 Hz. 
    myFGen.Frequency = 2500;
    % Set the amplitude to 1.2 volts. 
    myFGen.Amplitude = 1.2;
    % Set the offset to 0.4 volts. 
    myFGen.Offset = 0.4;
  8. Enable signal generation with the instrument, for example, output signals.

    In this example, the enableOutput function enables the function generator to produce a signal that appears at the output connector.

    % Enable the output of signals. 

    When you are done, disable the output.

    % Disable the output of signals. 
  9. After configuring the instrument and generating a signal, close the session and remove it from the workspace.

    clear myFgen;

For a list of supported functions for use with Quick-Control Function Generator, see Quick-Control Function Generator Functions.

Related Topics