Hello Friends, Meanwhile I was working on Digilent’s Spartan 3E Starter Board having Spartan 3E XC3S500 FPGA present on it.
I basically work on Embedded Application using FPGA, but usually I find most of my friends who work in the Power Electronics Domain use FPGAs for pulse generation for driving MOSFETs & IGBTs. So just gave a thought about writing a simple VHDL program to generate PWM.
I wrote a rough VHDL program to toggle the pin to HIGH and LOW depending on the pulse width, but I wanted to control the pulse width as per my requirements using hardware. To my rescue, I found that the FPGA development board which I was using “Spartan 3E starter Board”, contains a rotary encoder.
Luckily I got a reference rotary encoder VHDL code from some open source website and modified it for my application. Finally I combined my PWM generation VHDL code and Rotary Encoder code and got this working.
Using this experimental project, I am able to generate PWM pulses and depending on the rotary encoder’s direction of rotation, I am able to increase or decrease the pulse width.
You can see the demo video for your reference.
I used Xilinx 12.4 with Web Pack License. You can find completed VHDL source codes here:
Contents:
- top.vhd
- pwm.vhd
- rotary_encoder.vhd
- rotaryencoder.ucf (You should change this file as per your Board’s Configuration)
I hope you will find this useful!
Clarifications & Suggestions for improvement are always welcome. Thanks