Generate a Standard Waveform Using Waveform Function Generation Channels

This example shows how to use the function generation channel in a session to generate a sine waveform function, at 100kHz frequency. The signal’s output voltage range is set to -5.0 to +5.0 volts

Create a Digilent acquisition session

s = daq.createSession('digilent');

Use daq.getdevices to discover available Digilent devices.

Create a waveform function generation channel with a Sine WaveformType.

fgenCh = addFunctionGeneratorChannel(s, 'AD1', 1, 'Sine')
fgenCh = 

Data acquisition sine waveform generator '1' on device 'AD1':

              Phase: 0
              Range: -5.0 to +5.0 Volts
     TerminalConfig: SingleEnded
               Gain: 1
             Offset: 0
          Frequency: 4096
       WaveformType: Sine
     FrequencyLimit: [0.0 25000000.0]
               Name: ''
                 ID: '1'
             Device: [1x1 daq.di.DeviceInfo]
    MeasurementType: 'Voltage'

Set the channel’s amplitude to 5v using the Gain property and the channel frequency to 100KHz.

fgenCh.Gain = 5;
fgenCh.Frequency = 100e3
fgenCh

Data acquisition sine waveform generator '1' on device 'AD1':

              Phase: 0
              Range: -5.0 to +5.0 Volts
     TerminalConfig: SingleEnded
               Gain: 5
             Offset: 0
          Frequency: 100000
       WaveformType: Sine
     FrequencyLimit: [0.0 25000000.0]
               Name: ''
                 ID: '1'
             Device: [1x1 daq.di.DeviceInfo]
    MeasurementType: 'Voltage'

Specify the session to run for 5 seconds and start the generation.

s.DurationInSeconds = 5;
startForeground(s);