实现基于51控制28BYJ的步进电机的角度控制
时间:10-02
整理:3721RD
点击:
各位大神帮忙看下,小弟想控制电机的输出轴只转一圈就停的,我只给他八个脉冲,应该是转子只转了8步啊,可是为什么一直不停的转啊,如果我想控制电机的输出轴转30度45读或者一圈该怎么写程序
#include <reg52.h>
#define uchar unsigned char
uchar Step = 0;
unsigned char code F_Rotation[8]={0x08,0x0c,0x04,0x06,0x02,0x03,0x01,0x09};
void Delay(uint i)
{
uchar x,j;
for(j=0;j<i;j++)
for(x=0;x<=148;x++);
}
void main()
{
uchar i;
for(i=0;i<8;i++)
{
P1 = F_Rotation[i];
Delay(1);
}
}
#include <reg52.h>
#define uchar unsigned char
uchar Step = 0;
unsigned char code F_Rotation[8]={0x08,0x0c,0x04,0x06,0x02,0x03,0x01,0x09};
void Delay(uint i)
{
uchar x,j;
for(j=0;j<i;j++)
for(x=0;x<=148;x++);
}
void main()
{
uchar i;
for(i=0;i<8;i++)
{
P1 = F_Rotation[i];
Delay(1);
}
}
看看再说吧.
凯巴伯集团www.kaibabo.com
凯巴伯网络www.kaibabo.net东莞网站建设,东莞网页设计www.kaibabo.cn凯巴伯服饰产业发展有限公司 ,服装印花材料www.kaibabo.cn