hello friends,
I am using two LMD18245 chips for driving stepper motor with 8051
My motor is not moving but making a buzzing noise, is this a battery related
problem?or Code related problem?
PLZ help me...!!
i am using variable delay using switch.
And my code is:
#include
unsigned int i,j,l;
double k;
#define MR_A P2_2
#define MR_B P2_3
#define sw1 P2_5
#define sw2 P2_6
void forward(void);
void delay(void);
void main()
{
sw1=1;
sw2=1;
k=50000;
l=1;
P3=0x00;
P3=0xFF;
for(;

{
forward();
}
}
void delay(void)
{
for(j=0;j<l;j++)
{
TMOD=0x01;
TL0=0x00;
TH0=k;
TR0=1; // start timer.
while(TF0==0); // run until TF turns to 1
TR0=0; // stop timer
TF0=0; // reset the flag
}
}
void forward(void)
{
if(sw1==0)
{
k=k+10000;
}
if(sw2==0)
{
l=l+1;
}
MR_A=1;
MR_B=1;
delay();
MR_A=1;
MR_B=0;
delay();
MR_A=0;
MR_B=0;
delay();
MR_A=0;
MR_B=1;
delay();
}