Technical Proficiency Andtraining-1 Vlsi: Minor Project-1 On PWM Generator With Variable Duty Cycle
Technical Proficiency Andtraining-1 Vlsi: Minor Project-1 On PWM Generator With Variable Duty Cycle
Proficiency
andTraining-1
VLSI
MINOR PROJECT-1
On
PWM GENERATOR WITH Variable
Duty Cycle
Abstract
• This project demonstrates how a simple and fast pulse width modulator (PWM)
generator can be implemented using Verilog programming. It is simulated using
• The Verilog PWM (Pulse Width Modulation) generator creates a 10MHz PWM
signal with variable duty cycle. Two buttons which are debounced are used to
control the duty cycle of the PWM signal. The first push button is to increase the
duty cycle by 10%, and the other button is to decrease the duty cycle by 10%.
Contents
• INTRODUCTION
• METHODOLOGY
• IMPLEMENTATION
• RESULTS
• CONCLUSION
• REFERENCES
Introduction
The percentage of time in which the PWM signal remains HIGH (on time) is
called as duty cycle. If the signal is always ON it is in 100% duty cycle and if it
is always off it is 0% duty cycle. The formulae to calculate the duty cycle is
shown below.
module DFF_PWM(clk,en,D,Q);
input clk,en,D;
output reg Q;
always @(posedge clk)
begin
if(en==1)
Q <= D;
end
endmodule
Test bench
module tb_PWM_Generator_Verilog;
// Inputs
reg clk;
reg increase_duty;
reg decrease_duty;
// Outputs
wire PWM_OUT;
// Instantiate the PWM Generator with variable duty cycle in Verilog
PWM_Generator_Verilog PWM_Generator_Unit(
clk(clk),
increase_duty(increase_duty),
decrease_duty(decrease_duty),
PWM_OUT(PWM_OUT)
);
// Create 100Mhz clock
initial begin
clk = 0;
forever #5 clk = ~clk;
end
initial begin
increase_duty = 0;
decrease_duty = 0;
#100;
increase_duty = 1;
#100;// increase duty cycle by 10%
increase_duty = 0;
#100;
increase_duty = 1;
#100;// increase duty cycle by 10%
increase_duty = 0;
#100;
increase_duty = 1;
#100;// increase duty cycle by 10%
increase_duty = 0;
#100;
decrease_duty = 1;
#100;//decrease duty cycle by 10%
decrease_duty = 0;
#100;
decrease_duty = 1;
#100;//decrease duty cycle by 10%
decrease_duty = 0;
#100;
decrease_duty = 1;
#100;//decrease duty cycle by 10%
decrease_duty = 0;
end
endmodule
Results
Conclusion
In a nutshell the project is all about generation of PWM signals with varying duty
cycle using Verilog code and tested on ISE10.1 XILINX is used as software. The
comparator is necessary to compare between the data available in register and
counter to generate suitable PWM signals. The generated PWM signals have a fixed
frequency depended on the frequency of square wave, and a variable duty cycle that
changes from 0% to 100%. These signals can be used to drive a BLDC motor.
References
https://www.fpga4student.com/2017/08/verilog-code-for-pwm-generator.html
https://ieeexplore.ieee.org/document/7755586