Servo in Verilog
In order to control the servo, we are going to generate a PWM (pulse width module) signal in every 20 ms. The servo expects to see a pulse every 20 ms.
However, to change the servo position, we need to know how wide a pulse needed to be change. For example, at neutral position we need to generate a pulse of 1500 microseconds. To make servo change to -90 degrees, we generate 1000 microseconds, and 2000 microseconds for 90 degrees.
Generate a pulse to change its position might be not enough because the servo needs to take time to move, so we constantly generate more than a pulse and keep it the same.
Speed: The speed is defined on how quick the pulse is change. For this lab, we increment or decrement by 10.
This is the top level of servo block diagram that is written in verilog.
Here is a short demonstration of servo: