×
嵌入式 > 嵌入式开发 > 详情

MP28GA步进电机C语言测试程序

发布时间:2020-08-24 发布时间:
|
/************
步进电机测试程序
步进电机型号:MP28GA步进电机
驱动芯片:ULN2003

连接方式:P10~P13分别接ABCD
Author:Kevin Chin
Date:2010/07/17
Email:kevinchin@qq.com
************/
#include
#defineMotorPort P1
//unsigned char FMove[4] = {0xf1, 0xf2, 0xf4, 0xf8};//单四拍节 A、B、C、D驱动

//unsigned char FMove[4] = {0xf3, 0xf6, 0xfc, 0xf9};//双四拍节 AB、BC、CD、DA驱动


//单双8拍节 A、AB、B、BC、C、CD、D、DA驱动

unsignedcharFMove[8]={0xf1,0xf3,0xf2,0xf6,0xf4,0xf9,0xf8};

voidmDelay(unsignedinti)//延时约0.5ms

{
for(;i>0;i--)
{
unsignedcharj=244;
while(--j);
}
}

voidmain(void)
{
char*p,i,count;

p=FMove;
count=sizeof(FMove);

while(1)
{
for(i=0;i{
MotorPort=*(p+i);

mDelay(5);
}

}
}


『本文转载自网络,版权归原作者所有,如有侵权请联系删除』

热门文章 更多
发明专利在疫情影响下的逆势增长