void motor()
{
//A/
PH1 = 0;
I01 = 0;
I11 = 0; //以最大电流输出
PH2 = 1;
I02 = 1;
I12 = 1; //关闭电流输出
delaydj(rate);
// A/B
PH1 = 0; //PH1为0 A组线圈为反向电流
I01 = 0;
I11 = 0;
PH2 = 1; //PH2为1 B组线圈为正向电流
I02 = 0;
I12 = 0;
delaydj(rate);
//B
PH1 = 1;
I01 = 1;
I11 = 1;
PH2 = 1;
I02 = 0;
I12 = 0;
delaydj(rate);
//AB
PH1 = 1;
I01 = 0;
I11 = 0;
PH2 = 1;
I02 = 0;
I12 = 0;
delaydj(rate);
//A
PH1 = 1;
I01 = 0;
I11 = 0;
PH2 = 0;
I02 = 1;
I12 = 1;
delaydj(rate);
//AB/
PH1 = 1;
I01 = 0;
I11 = 0;
PH2 = 0;
I02 = 0;
I12 = 0;
delaydj(rate);
// B/
PH1 = 0;
I01 = 1;
I11 = 1;
PH2 = 0;
I02 = 0;
I12 = 0;
delaydj(rate);
// A/B/
PH1 = 0;
I01 = 0;
I11 = 0;
PH2 = 0;
I02 = 0;
I12 = 0;
delaydj(rate);
}
/*******************延时函数****************************/
void delaydj(int time)
{
int i,j;
for(j=0; j <= 2; j++)
for(i =0 ; i <=time; i++);
}
51单片机通过UDN2916驱动双极性两相四线步进电机转动,采用半步八拍的运行方式,请问怎么算转速。
步距角为3.75°。晶振频率(时钟频率)12MHz。延时程序rate最大等于160.最小为40.
两相四线步进电机接线问题。 我用的是udn2916芯片控制的电机就是不...
先用4个51欧电阻代替电机的4个绕组,连接到电路板。用示波器观测波形有没有及频率、电压幅度等。电压应为5V左右,频率10-几百赫兹;太高了电机转不起来的。如果没波形或频率不正常,检查程序吧!