Generating a pulse wave using Pymoku
Using ncycle mode to generate a pulse wave
If you still have questions or prefer to get help directly from an agent, please submit a request.
We’ll get back to you as soon as possible.
Moku:Go Arbitrary Waveform Generator Moku:Go Data Logger Moku:Go Frequency Response Analyzer Moku:Go Logic Analyzer & Pattern Generator Moku:Go Oscilloscope & Voltmeter Moku:Go PID Controller Moku:Go Spectrum Analyzer Moku:Go Waveform Generator Moku:Go Power Supplies Moku:Go Digital Filter Box Moku:Go FIR Filter Builder Moku:Go Lock-in Amplifier
Pulse waves are not pre-set in Pymoku, different from sine waves and square waves.
To generate a pulse wave, we need to combine the square wave with the set_trigger function. The square wave should have a DC offset that is half its peak-to-peak voltage. The pulse is achieved by using the ncycle mode in the set_trigger function, where ncycles = 1. The pulse width is determined by the square wave frequency and duty cycle, the pulse frequency is set by the trigger period or frequency.
The example below generates a pulse wave with an amplitude of 1 Vpp and a frequency of 1 Hz.
# pymoku example: Waveform Generator Pulse Wave # # This example demonstrates how you can use the Waveform Generator instrument # to generate a pulse wave on Channel 1. # # (c) 2021 Liquid Instruments Pty. Ltd. # from pymoku import Moku 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: # Deploy the Waveform Generator to your Moku i = m.deploy_instrument(WaveformGenerator) # Generate a squarewave (amp = 1 Vpp, freq = 500 Hz, offset = 0.5) on channel 1. i.gen_squarewave(1, amplitude=1.0, frequency=500, offset=0.5) # Configure the Moku's front end. i._set_frontend(channel=1, fiftyr=True, atten=True, ac=False) i._set_frontend(channel=2, fiftyr=True, atten=True, ac=False) # Configure channel 1 square wave to ncycle trigger mode, with internal # clock as the trigger. With the number of cycles set to 1, this is a # pulse wave. The signal will pulse every second. i.set_trigger(ch=1, mode='ncycle', ncycles=1, trigger_source='internal', trigger_threshold=0, internal_trig_period=1) finally: m.close()