This is an AT89C51 single-chip DC motor PWM speed control program. The program can be directly used in AT89C52, AT89S51, AT89S51, STC89C51, STC89C52 single-chip microcomputers. The single-chip crystal oscillator uses 11.0592M. The DC motor is controlled by the L298 integrated circuit. The frequency of the generated PWM is about It is 91Hz. The pins of L298 have been marked in the program. You can draw the schematic diagram by yourself, and it will not be given here. The following is the source program.
#includeï¼»reg52.hâ€//Please replace 'ï¼»' with ““, the same below. Otherwise, errors will occur during compilation.
#include [intrins.h》//
#define uchar unsigned char
#define uint unsigned int
sbit en1=P2^0;
sbit en2=P2^1;
sbit s1=P2^2;
sbit s2=P2^3;
sbit s3=P2^4;
sbit s4=P2^5;
uchar t=0;
uchar m1=0;
uchar m2=0;
uchar tmp1, tmp2;
void motor (uchar index, char speed)
{
if (speed "=-100 && speed "=100)
{
if(index==1)
{
m1=abs(speed);
if(speed《0)
{
s1=0;
s2=1;
}
else
{
s1=1;
s2=0;
}
}
if(index==2)
{
m2=abs(speed);
if (speed《0)
{
s3=0;
s4=1;
}
else
{
s3=1;
s4=0;
}
}
}
}
void delay (uint j)
{
for(j;j》0;j--);
}
void main()
{
char i;
TMOD=0x02;
TH0=0x9B;
TL0=0x9B;
EA=1;
ET0=1;
TR0=1;
while(1)
{
for(i=0;i《=100;i++)
{
motor(1, i);
motor(2,i);
delay(5000);
}
for(i=100;i》0;i--)
{
motor(1, i);
motor(2,i);
delay(5000);
}
for(i=0;i《=100;i++)
{
motor(1, -i);
motor(2, -i);
delay(5000);
}
for(i=100;i》0;i--)
{
motor(1, -i);
motor(2, -i);
delay(5000);
}
}
}
void timer0() interrupt 1
{
if(t==0)
{
tmp1=m1;
tmp2=m2;
}
if(t
if(t
t++;
if(t》=100) t=0;
}
Shaft inserting is one of the process for rotor production for motors and generators. Some of customers require the Rotor Core, but some of them also require the rotor with shaft. We are able to do shaft inserting for both samll and big rotors. And we can also do lathe work for rotors after inserting the shafts.
Rotor Shaft Inserting,Rotor Shaft,Rotor With Shaft,Motor Rotor Shaft
Henan Yongrong Power Co., Ltd , https://www.hnyongrongglobal.com