interfacing dc motor with 8051

Thread Starter

bobparihar

Joined Jul 31, 2014
93
i am having problem in simulating DC motor in anticlockwise direction on Proteus 8.0 when connected to AT89C51 micro controller. It works correctly in clockwise direction, but stops in anticlockwise direction.
here is the code

Rich (BB code):
#include<reg51.h>
sbit a=P2^0;  // given to l293d pin
sbit b=P2^1;  //given to l293d pin
void main()
{
    
    while(1)
    {
        
    a=0;
    b=1;
    for(i=0;i<55000;i++);      //delay
    a=1;
    b=0;
    for(i=0;i<55000;i++);

    }
}
please help:(
 
Last edited by a moderator:

MrChips

Joined Oct 2, 2009
30,708
Try putting delays in between a and b assignments:

Rich (BB code):
#include<reg51.h>
sbit a=P2^0;  // given to l293d pin
sbit b=P2^1;  //given to l293d pin
void main()
{
    
    while(1)
    {
        
    a=0;
    for(i=0;i<55000;i++);      //delay
    b=1;
    for(i=0;i<55000;i++);      //delay
    a=1;
    for(i=0;i<55000;i++);      //delay
    b=0;
    for(i=0;i<55000;i++);

    }
}
 

Thread Starter

bobparihar

Joined Jul 31, 2014
93
i want to ask a question here to everyone...
should i connect the dc motor directly to the output pins of L293D IC or i should connect it using some protection(any resistors,or diodes etc.) at the hardware level.
 
Top