In :from pynq import Overlay Overlay("base.bit").download()
In this example, we choose the Digilent Analog Discovery 2 as the scope.
1+pin (of channel 1) has to be connected to pin 0 on PMODA interface.
1-pin (of channel 1) has to be connected to
GNDon PMODA interface.
This example uses PMODA interface. In order to use PMODB interface, users can replace PMODA to PMODB in the examples below. Similarly, users can change the pin number.
In :from pynq.iop import Pmod_PWM from pynq.iop import PMODA pwm = Pmod_PWM(PMODA, 0)
In this example, we generate a $10\,\mu$s clocks with $50\%$ duty cycle for 4 seconds and the stop. Issuing stop command stops both timer sub-modules.
Users have to choose channel 1 for waveform display in the scope.
The output would look like this:
In :import time # Generate a 10 us clocks with 50% duty cycle period=10 duty=50 pwm.generate(period,duty) # Sleep for 4 seconds and stop the timer time.sleep(4) pwm.stop()
In :import time # Generate a 20 us clocks with 25% duty cycle period=20 duty=25 pwm.generate(period,duty) # Sleep for 5 seconds and stop the timer time.sleep(5) pwm.stop()