Skip to main content

How to interface dc motor with AT89C51 in bi-direction

hi, how are you today



Let's learn how to interface a DC motor with our baby (8051uC)

Description

This article helps you to understand the concept behind the interfacing of dc motor to produce bi-direction motion i.e. forward and backward direction. The  concept behind the working of dc motor is simple, it consist of a magnetic coil and a magnet that rotates as per the magnetic field generated in coil by applying the voltage from outer source. Direction of rotation is totally depends on the polarity
of voltage applied on dc motor. By changing polarity i.e. +ve & -ve terminals, we can change the polarity of dc motor to change the direction of motion. So in working state it is not possible to change the polarity each and every time physically. So here I am going to help you to understand the logic how to control this thing by programming.
To change polarity of motor we need H-bridge circuit. You can use L293D motor driving
IC with 2 inbuilt H-Bridge ckt. Here I made a H-bridge ckt with four BC547 transistors
to clear your concept that how H-bridge works.

Here all the 4-pins of bc547 are connected to first 4 pins of port3 of AT89C51.   

Here we will learn how to controll dc motor in bi-direction motion using a H-brigde
by using 4 bc547 transistors that helps to amplifying the current.

Programming

1:  #include<reg51.h>      // header file  
2:  void delay(int time)    // function to generate delay  
3:     {  
4:     int i,j;  
5:     for(i=0;i<=time;i++) // i will run from 0 to user defined value  
6:     for(j=0;j<=1275;j++); // j will run from 0 to 1275 "time" times  
7:     }  
8:  sbit m1= P3^0;  
9:  sbit m2= P3^1;  
10:  sbit m3= P3^2;  
11:  sbit m4= P3^3;  
12:  void main()         // main function  
13:     {  
14:      while(1)       // while(1)used to provide continuous loop  
15:       {  
16:        m1=m3=1;  
17:        m2=m4=0;       
18:        delay(200);     
19:        m2=m4=1;  
20:        m1=m3=0;  
21:        delay(200);     
22:       }  
23:     }  

For enhance concept just visit www.salahtutorials.com
Hope you all like this post and I wish this must be useful for you.
Thanks :)

Comments

Translate to your language

Popular posts from this blog

Different Stages of I2C communication

Different Stages Of I2C

How to import Pygame in pycharm

hi, how are you today

Working demonstration of UART communication using 2 8051 uController on Proteus with Embedded C code.

Here we are going to use 2 at89c51 uControllers just to understand UART communication in 8051.