新闻中心

EEPW首页>嵌入式系统>设计应用> 步进电机驱动程序

步进电机驱动程序

作者: 时间:2016-11-28 来源:网络 收藏

本文引用地址://m.amcfsurvey.com/article/201611/322999.htm

#include
#define uint unsigned int
sbit A=P1^0; //控制A的电流方向,0为反,1为正
sbit di=P1^1;
sbit A1=P1^2;
sbit A2=P1^3; //控制A的速度
sbit B1=P1^4;
sbit B2=P1^5;//控制B的速度
void delayms(uint z)
{
uint x,y;
for(x=z;x>0;x--)
for(y=110;y>0;y--);
}
void run()
{
A=0;
A1=0;
A2=0;
delayms(5);

di=1;
B1=0;
B2=0;
delayms(5);

A=1;
A1=0;
A2=0;
delayms(5);

di=0;
B1=0;
B2=0;
delayms(5);
}

void main()
{
while(1)
{
run();
}
}



关键词:步进电机驱动程

评论


技术专区

关闭