谁有基于51单片机的步进电机C程序,可实现启动,停止,加减速,并显示等,找了半天没找到?
#include
unsigned char code F_Rotation[4]={0x08,0x10,0x20,0x40};//正转表格
unsigned char code B_Rotation[4]={0x40,0x20,0x10,0x08};//反转表格
void Delay(unsigned int i)//延时
{
while(--i);
}
main()
{
unsigned char i;
while(1)
{
for(i=0;i
{
P1=F_Rotation[i]; //输出对应的相 可以自行换成反转表格
Delay(500); //改变这个参数可以调整电机转速
}
}
}
来源:文章来源于网络,如有侵权请联系我们及时删除。本文由机械网转载编辑,欢迎分享本文!