/************
步进电机测验程序
步进电机类型: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);
}
}
}