51proteus仿真:proteus中的步进电机的接法与时序

51proteus仿真:proteus中的步进电机的接法与时序

 

proteus中的步进电机有两种,

六线制(MOTOR-STEPPER)和四线制(MOTOR-BISTEPPER),六线制的左右中间两根线接电源,任然剩下四根,但是,这四根的顺序和四线制的不同,见下图。

注意a,b,c,d的顺序

51proteus仿真:proteus中的步进电机的接法与时序_第1张图片

 在实际情况中,单片机是不能直接拖动步进电机的,需用ULN2003这样的器件

两个步进电机都是四相电机。

如果用四拍:

那么P2输出的(顺时针)顺序就是:0x03,0x06,0x0c,0x09

a  1   0    0     1

b  1   1    0     0

c  0   1    1     0

d  0   0    1     1

 

如果用八拍:

 

那么P2输出的(顺时针)顺序就是:0x01,0x03,0x02,0x06,0x04,0x0c,0x08,0x09

 

a  1   1   0    0    0    0     0    1

b  0   1   1    1    0    0     0    0

c  0   0   0    1    1    1     0    0

d 0   0   0    0    0    1     1    1

 

给一个测试八拍的仿真程序:

 

#include


main(){

while(1){

unsigned int i,j,k;

 for(k=0;k<255;k++){

for(i=0;i<75;i++)
for(j=0;j<255;j++);

P2=0x01;
 for(i=0;i<75;i++)
for(j=0;j<255;j++);

P2=0x03;

   for(i=0;i<75;i++)
for(j=0;j<255;j++);

P2=0x02;


  for(i=0;i<75;i++)
for(j=0;j<255;j++);

P2=0x06;

 for(i=0;i<75;i++)
for(j=0;j<255;j++);

P2=0x04;
 for(i=0;i<75;i++)
for(j=0;j<255;j++);

P2=0x0c;

   for(i=0;i<75;i++)
for(j=0;j<255;j++);

P2=0x08;


  for(i=0;i<75;i++)
for(j=0;j<255;j++);

P2=0x09;

 

 

 }

  }
}

 

转载于:https://www.cnblogs.com/proteus/archive/2011/11/14/2248850.html

你可能感兴趣的:(51proteus仿真:proteus中的步进电机的接法与时序)