电机是4线,两两互通应该是个2相电机 ,我用P1.0-P1.3接达林顿管再接电机
我的程序,但死活都不转 还是我程序搞错了
#include<reg52.h>
#define uchar unsigned char
#define uint unsigned int
uchar code table[]={0x08,0x0a,0x02,0x06,
0x04,0x05,0x01,0x09};
//a+ a- b+ b-
//1 0 0 0
//1 0 1 0
//0 0 1 0
//0 1 1 0
//0 1 0 0
//0 1 0 1
//0 0 0 1
//1 0 0 1
void delay(uint a)
{
uchar i,j;
for(i=a;i>0;i--)
for(j=110;j>0;j--);
}
void main()
{
while(1)
{
uchar x;
for(x=0;x<8;x++)
{
P1=table[x];
delay(5);
}
}
} |