Contact Us

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.

Please fill out the contact form below and we will reply as soon as possible.

  • Knowledge Base Home
  • Contact Us
  • Home
  • Moku:Lab
  • Software integrations
  • Python

Generating a pulse wave using Pymoku

Using ncycle mode to generate a pulse wave

Written by Nandi Wu

Updated at March 3rd, 2021

Contact Us

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.

Please fill out the contact form below and we will reply as soon as possible.

  • Moku:Go
    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
  • Moku:Lab
    Windows Moku:Lab general Moku:Lab Instruments iPad app Software integrations
  • Moku:Pro
    Moku:Pro Instruments
+ More

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()


moku:lab pulse waveform generator pymoku python

Was this article helpful?

Yes
No

Related Articles

  • pyMoku experiences deploy errors
  • Python Waveform Generator : burst mode
  • Getting started with pyMoku

Sitemap

  • Moku:Lab
  • Instruments
  • Software
  • Company
  • Support
  • Store
  • Terms & Conditions
  • Privacy Policy

Offices

United States
+1 (619) 332-6230
740 Lomas Santa Fe Dr
Suite 102
Solana Beach, CA 92075

Australia
+61 2 6171 9730
243 Northbourne Avenue
Suite 2
Lyneham, ACT 2602

Follow us

Youtube LinkedIn

官方微信

Contact us
© 2021 Liquid Instruments. All rights reserved.

Definition by Author

0
0
Expand