1.连接电路图,
上面一点的电机是motor-bistepper,下面一点的是motor-stepper.
2.
//glocal.h
//latest revise:2010-07-01
//by:alex shoal
//email:alex.shoal@gmail.com
#define uchar unsigned char
#define uint unsigned int
void delay(int t){
for( ;t!=0; t--);
}
//main.c
//main.c
#define _MAIN_C_
#include "reg51.h"
#include "stdio.h"
#include "math.h"
#include "stdlib.h"
#include "global.h"
void main()
{
unsigned int i;
int step[4];
step[0]=3; //0011
step[1]=6; //0110
step[2]=12; //1100
step[3]=9; //1001
while(1)
{
for(i=0;i<4;i++)
{
P2=step[i];
delay(96000);
}
}
}
如果是八相
程序则可改成。
int step[8];
step[0]=1; //0001
step[1]=3; //0011