Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic 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.

Register Log in

plz plz help controller not working to drive dc motor

Status
Not open for further replies.

uzmeed

Member level 2
Joined
Oct 1, 2010
Messages
44
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,624
Hi

I m using AT89C51/AT89S51 to drive the motor

the circuit is like controller generates the PWM on two pins( 50% duty cycle + equal and opposite)
that is fed into a latch and in turn latch drives the transistor + relay circuit

The relay in the response runs the motor in CW/ACW direction depending on PWM signal

my problem is that some times the program collapse and the controller does not accept and interrupt or input and starts rotating motor in single direction at very high speed. At that point the only way out is the complete shut down of circuit nothing else works

It is more likely to happen with 89c51 and less with 89s51

what cud be the possible reason

the program i wrote is


#include<reg51.h>
#include<stdio.h>


sbit out1=P2^0;
sbit out2=P2^1;


sbit sel1=P2^6;
sbit sel2=P2^7;


void main()


{

unsigned int count,initial;
P0=0;
P1=0;
P2=0;
P3=0;
//p0=0,p1=0;

for(initial=0;initial<100;initial++)
{
out2=0;
out1=0;

}


while(1)

{

if((sel1==1) && (sel2==0))
{
//sel1=0;

for(count=0;count<6500;count++)
{
out2=1;
out1=0;

}


for(count=0;count<50;count++)
{
out2=0;
out1=0;

}
for(count=0;count<6500;count++)
{
out2=0;
out1=1;

}

}

else if((sel1==0) && (sel2==1))

{

//sel2=0;
for(count=0;count<13500;count++)
{
out2=1;
out1=0;

}


for(count=0;count<500;count++)
{
out2=0;
out1=0;

}
for(count=0;count<13500;count++)
{
out2=0;
out1=1;

}

for(count=0;count<500;count++)
{
out2=0;
out1=0;

}

}


else if (((sel1==0) && (sel2==0)) ||((sel1==1) && (sel2==1)))
{

out1=0;
out2=0;
}




}

}


plz point out any mistake in the program . Plz also note that this problem occur when i connect the load on the circuit other wise it runs fine on no load
 

alexxx

Advanced Member level 4
Joined
Apr 17, 2011
Messages
1,013
Helped
273
Reputation
552
Reaction score
270
Trophy points
1,383
Location
Greece
Activity points
7,938
Please post the circuit, it might be a hardware problem.
 

uzmeed

Member level 2
Joined
Oct 1, 2010
Messages
44
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,624
here is the circuit diagram

i hope now i can know where i m mistaken

uzmeed

 

alexan_e

Administrator
Joined
Mar 16, 2008
Messages
11,895
Helped
2,021
Reputation
4,158
Reaction score
2,031
Trophy points
1,393
Location
Greece
Activity points
64,377
Your image is too small and not clearly visible, you have to attach a bigger one

Alex
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top