| 目的:要让两相六线步进电机转起来。 驱动芯片是ULN2003,驱动电压是12V。
 程序如下:
 #include“reg51.h”
 unsigned char table[ ]={0xfe,0xfd,0xfb,0xf7};
 unsigned char step;
 void delay(unsigned char t)
 {
 unsigned char i;
 for(;t>0;t--)
 for(i=0;i<200;i++);
 }
 main()
 {
 while(1)
 {
 step=0;
 P1=table[step];
 delay(10);
 step++;
 if(step==4)
 {
 step=0;
 }
 }
 }
 为什么程序正常的情况下(用二极管证明程序正确),步进电机就是转比起来?
 麻烦大家帮忙解决下,谢谢。
 |