i have made a circuit that controls speed and direction of a pmdc motor using 89s52microcontroller now i need to make it a closed loop can some one help me with the code and circuit..
Here is a simple method that is well within the capability of the 8052 microcontroller without advanced peripherals.
Create an A-D converter for voltage feedback using a V-F converter scaled to: 100kHZ = full speed--I have used the Exar 4151 with good success, but not by using the circuit provided on the spec sheet. The sign bit (direction) is provided by a simple comparator that detects voltage polarity.
Establish a time base of 10mS--this provides a count of 1000 at full speed for a resolution of 0.1%. Now that may seem excessive resolution, but it is required to make a PI (proportional-Integral) loop work without being lumpy.
Count the oscillator with an external interrupt.
This will provide you something to start with--if you choose to go in this direction, I will rough out the V-F circuit for you.