Python Waveform Generator : burst mode

Example script for burst (N-cycle) mode in Python

The script below enables Python to setup the Waveform Generator in burst (or N-cycle) mode.  It generates 20 cycles of a 10 MHz sine wave,  2 Vpp;  repeating every 200 us.

 

# pymoku example: Waveform generator n-cycle burst mode
#
# This example demonstrates how you can configure the waveform generator
# instrument to generate signals in burst mode for a set number of cycles
# using internal triggering
#
# (c) 2019 Liquid Instruments Pty. Ltd.
#
from pymoku import *
from pymoku.instruments import WaveformGenerator


# Connect to your Moku by its device name
# Alternatively, use Moku.get_by_serial('#####') or Moku('192.168.###.###')
m = Moku.get_by_name('Moku')

try:
i = m.deploy_instrument(WaveformGenerator)

# Set output 1 to generate sine wave, 2Vpp, 10 MHz
i.gen_sinewave(1, 2, 10e6)

# Activate trigger for output channel 1
i._sweep1.wait_for_trig = 1


# Setup n-cycle for 20 cycles, internally triggered every 200 us
i.set_trigger(1, mode='ncycle', ncycles=20, trigger_source ='internal', trigger_threshold=0.1, internal_trig_period=200e-6, internal_trig_high=5e-6)

finally:
# Close the connection to the Moku device
# This ensures network resources and released correctly
m.close()