Continue to Site

Welcome to

Welcome to our site! is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

speed control of dc motor using 8051

Not open for further replies.


Member level 5
Aug 20, 2012
Reaction score
Trophy points
Activity points
hi everyone i am doing one project like i want to interface dc motor with 8051 ic89c51rd2 in that i want to control the speed of dc motor i dont know how to control that can any anyone please help me thanks....

- - - Updated - - -

currently i am using this circuit

hi pradeep,

you can use the pwm(pulse width modulation) to control dc motor.

i have made such a project before some time.

i have made temperature controlled fan using atmega16 and pwm.

best luck..

-prafful sorani
hi thanks for reply u have any circuits about that can you post that ........

- - - Updated - - -

i don't know how to use that i am new to that one .....

- - - Updated - - -

can any one please send the schematic diagram of 8051 based speed control of dc motor using pwm technique....

even i am also using like that interrupt and same circuit i am not getting it correctly .....

- - - Updated - - -

hi prafful i use that code but its not working......

In the doc. you can replace T89C51AC2 with P89V51RD2, because both have the special register to generate PWM. (See Doc. & the datasheet of P89V51RDD2)

All The Best


  • PWM Tutorial using 8051.pdf
    62.5 KB · Views: 155

hi everyone thanks for replying i am using that ic only 89v51rd2 but its not working what will be the problem .....

there may b many posibility for problem. .
I have no idea in assambly language. .

I have good hand on BASCOM AVR. . If u need related to it i can help you. .

Best luck

hello prafful i am using C language only can u help in that ....

i am using the same circuit you linked one circuit that only but i how it speed decreases.....

- - - Updated - - -

and i am using same code also..... but ii doesn't work properly......................


sbit sw1=P3^2;
sbit sw2=P3^3;

sbit L293D_A = P1^0; //Make positive of motor 1
sbit L293D_B = P1^1; //Make negative of motor 0
sbit L293D_E = P1^2; //Enable L293D

void rotate_f(void); //Forward run funtion
void rotate_b(void); //Backward run function
void breaks(void); //Motor stop function
void delay(void); //Some delay

void main(){
//Our main function
while(1){ //Infinite loop

if(sw1==1 && sw2==0)
rotate_f(); //Run forward
delay(); //Some delay
breaks(); //Stop
delay(); //Some delay

if(sw2==1 && sw1==0)
rotate_b(); //Run Backwards
delay(); //Some delay
breaks(); //Stop
delay(); //Some delay
} //Do this infinitely

void rotate_f(){
L293D_A = 1; //Make positive of motor 1
L293D_B = 0; //Make negative of motor 0
L293D_E = 1; //Enable L293D

void rotate_b(){
L293D_A = 0; //Make positive of motor 0
L293D_B = 1; //Make negative of motor 1
L293D_E = 1; //Enable L293D

void breaks(){
L293D_A = 0; //Make positive of motor 0
L293D_B = 0; //Make negative of motor 0
L293D_E = 0; //Disable L293D

void delay(){ //Some delay...
unsigned char i,j,k;



  • https15.postimage.orggo6alyeazCapture.png
    18.1 KB · Views: 170
Last edited:


    Points: 2
    Helpful Answer Positive Rating
again hi everyone the above program i posted is correct or wrong in that i am using interrupt to change the direction of motor ........

Not open for further replies.

Part and Inventory Search

Welcome to