Home > other >  Tracking the car problem: the wheels did not turn motor work
Tracking the car problem: the wheels did not turn motor work

Time:12-24

Each elder, I just do c51 tracking car, I personally think that there is no problem, the connection line is no problem, but I don't know why, after the power motor in the work but the wheels did not turn, but when I put the half fixed single chip switch is loose, the right wheel began to move, right round revolver occasionally move but full of a lot of, don't know what's wrong, hope everybody who help me take a look at what's going on,


The following is my application:
# include "reg52. H"


Sbit IN1 P1=^ 1;
Sbit IN2=p ^ 2;
Sbit IN3 P1=^ 3;
Sbit IN4=P1 ^ 4;
Sbit ENA P1=^ 0;//* o u?? Ue1? U
Sbit ENB=P1 ^ 5;//oo mu???? Ue1? U
Sbit lse1=P3 ^ 2;//* o +? Oiia '?? D? Present
Sbit lse2=P3 ^ 3;//oo +? Oiia '?? D? Present


# define uchar unsigned char
# define uint unsigned int


Unsigned char zkb1=0;//* o u?? U?????? Plus or minus e
Unsigned char zkb2=0;//oo mu???? U?????? Plus or minus e

int t=0;


Void PIT_Init ()
{
EA=1;
TMOD |=0x01;
TH0=(65536-200)/256;
TL0=(65536-200) % 256;
ET0=1;
TR0=1;
}


Void the timer interrupt 1//interrrupt 1 ()? a? U2?? D?? On? 0? Aia2?? D??
{
TH0=(65536-200)/256;
TL0=(65536-200) % 256;

If (t{
ENA=1;
}
The else
{
ENA=0;
}

If (t{
ENB=1;
}
The else

{
ENB=0;
}

T=(t + 1) % 50;
}



Void delay (uint I)
{
while(i--);

}





Void forward ()
{
Zkb1=10;
Zkb2=10;
IN1=1;
IN2=0;
IN3=1;
IN4=0;
}
Void the stop ()
{
Zkb1=0;
Zkb2=0;
IN1=0;
IN2=0;
IN3=0;
IN4=0;

}
Void turnleft ()
{
Zkb1=15;
Zkb2=15;
IN1=0;
IN2=1;
IN3=1;
IN4=0;
}
Void turnright ()
{
Zkb1=15;
Zkb2=15;
IN1=1;
IN2=0;
IN3=0;
IN4=1;
}






Void xunji ()
{

If ((lse1==0) & amp; & (lse2==1))
{
Turnleft ();//* o +?? I2a mu? Ou??
}
Else if ((lse1==1) & amp; & (lse2==0))
{
Turnright ();//oo +?? I2a mu? Ou??
}
Else if ((lse1==1) & amp; & (lse2==1))
{
Forward ();//a? +/-??????? ODou??
}
The else
{
stop();//?? ODou?? On?? Ii on? 1
}



}
Void main ()
{
PIT_Init ();
Forward ();
While (1)
{
Xunji ();//? -? On
}
}
  • Related