<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Pmod PWM
In this notebook, The Pmod PWM driver is exercised.  Specifically, An AXI Timer is used to a generate pulse width modulated (PWM) signal.  
To see the results of this notebook, you will need a Digilent Analog Discovery 2
<td> <img src="http
Step1:  2. Connect Scope
In this example, we choose the Digilent Analog Discovery 2 as the scope. 
The 1+ pin (of channel 1) has to be connected to pin 0 on PMODA interface. 
The 1- pin (of channel 1) has to be connected to GND on 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.
Step2:  3. Generate a clock of $50\%$ duty cycle and $10\,\mu$s period
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
Step3:  4. Generate a clock of $25\%$ duty cycle and $20\,\mu$s period
Repeating the above test for another set of parameters. The output would look like this
<ASSISTANT_TASK:>
Python Code:
from pynq.overlays.base import BaseOverlay
base = BaseOverlay("base.bit")
Explanation: Pmod PWM
In this notebook, The Pmod PWM driver is exercised.  Specifically, An AXI Timer is used to a generate pulse width modulated (PWM) signal.  
To see the results of this notebook, you will need a Digilent Analog Discovery 2
<td> <img src="http://cdn6.bigcommerce.com/s-7gavg/products/468/images/2617/Analog_Discovery_2_obl_Academic_600__01249.1447804398.1280.1280.png" alt="Drawing" style="width: 250px;"/> </td>
and WaveForms 2015
<td> <img src="https://reference.digilentinc.com/_media/reference/software/waveforms/waveforms-3/waveforms3-0.png" alt="Drawing" style="width: 250px;"/> </td>
1. Instantiation
Import overlay and instantiate Pmod_PWM class.
End of explanation
from pynq.lib import Pmod_PWM
pwm = Pmod_PWM(base.PMODA,0)
Explanation: 2. Connect Scope
In this example, we choose the Digilent Analog Discovery 2 as the scope. 
The 1+ pin (of channel 1) has to be connected to pin 0 on PMODA interface. 
The 1- pin (of channel 1) has to be connected to GND on 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.
End of explanation
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()
Explanation: 3. Generate a clock of $50\%$ duty cycle and $10\,\mu$s period
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:
<img src="data/pwm_50_duty_cycle.jpg" width="791px"/>
End of explanation
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()
Explanation: 4. Generate a clock of $25\%$ duty cycle and $20\,\mu$s period
Repeating the above test for another set of parameters. The output would look like this:
<img src="data/pwm_25_duty_cycle.jpg" width="791px"/>
End of explanation
<END_TASK>