brock

Thursday, July 26, 2012

DC Motor Interface with 8051 Microcontroller


A DC motor runs with the help of Direct Current. It produces torque by using both electricity and magnetic fields. The common term used to refer both fields is Electromagnetism. When a current carrying conductor is placedin the external magnetic field, then it will experience a force proportional to the current in the conductor and strength of the external magnetic field.
                        F = B*L*I
Where F is force in dynes.
            B is flux density in lines per square centimetres.
            L is length of the conductor
            I  is current in the conductor.

The same principle is used in the DC motor. The DC motor has rotor, stator, field magnet, brushes, shaft, commutator. The DC motor requires more current to produce initial torque than in running state.

Schematic

Code

#include
# define MOTOR P0

void delay(unsigned int);

void main()
{
    while(1)
    {
     MOTOR=0X01;
     delay(20);
     MOTOR=0X02;
     delay(20);
     MOTOR2=0X0A;
     delay(20);
     MOTOR2=0X08;
     delay(20);
    }




with this code u can control two motors in clockwise as well as counter clockwise...