Servo Controller
By: Marc Binette
With insight from Ralph Nevins
If you do not know what a servo is or how it works, go to the following web page as it contains a brief description of servos:
http://www.seattlerobotics.org/guide/servos.html
There are many different methods one could use to implement a servo controller. Our design consisted of a two legged robot with two servos per leg.
We choose above form given an external 4us clock, a four bit load and a eight bit data.
The four bit load was to specify which servo is to be loaded with the data from the data input. This data was loaded into eight bit register, labeled as 8bit holding.
The twelve bit counter was to serve two purposes. The first was to load the registers below the 8bit holding only once per clock cycle. The second function was for it to be compared with the values from the different servo registers. The values it was compared to are limited so the result is pulses of 1.024 ms to 2.044ms which correspond to the servo being at 0 degrees and 180 degrees respectively. The counter also outputs it's top four bit(to be used elsewhere in our design).
Not shown on the diagram is a d flip-flop on each of the four outputs to the servos. The flip-flops load on the rising edge of the 4 us clock. The purpose of the flip-flops is to take out any glitches that the comparator my cause.
Here is the VHDL code for the design:
The n-bit counter with default of 12 bits, an overflow bit, and outputs of each of the top four bits(for counting purposes in other parts of our design). counter.vhd
The 8bit_holding is generic with the default set to 8 bits. It also has a reset and loads on the rising edge of load input. 8bithold.vhd
The registers are more or less the same as the 8bit_holding. register8bit.vhd
The comparator takes in an eight bit number and adds "0001" as its most significant bits and then compares it to a twelve bit input It outputs high when the twelve bit input is less than the first input. comparator.vhd
The d flip-flop ( not shown on the diagram) loads on the rising edge of the load. dflip.vhd
The package file has all of the above components in it so that they can easily called in the master program. package.vhd
The master program connects all of the above components together in the manner shown in the diagram. servo_controller.vhd