新闻中心

EEPW首页 > 嵌入式系统 > 设计应用 > 三相步进电机控制

三相步进电机控制

作者:时间:2011-11-28来源:网络收藏

六拍工作方式,正转的绕组通电顺序:A、AB、B、BC、C、CA、A,反转的通电顺序:A、AC、C、CB、B、BA、B、A。

本文引用地址:http://www.eepw.com.cn/article/172401.htm

由于转子有一定的惯性以及所带负载的惯性,故的工作过程中不能及时的启动和停止,在启动时应慢慢的加速到预定速度,在停止前应逐渐减速到停止,否则,将产生失步现象。

步进电机的问题可总结为两点:

1、产生工作方式需要的时序脉冲;

2、步进电机的速度,使它始终遵循加速、匀速、减速的规律工作。

C程序

#includeio8515v.h>

#includemacros.h>

const char zhzhuan[7]={0x06,0x04,0x05,0x01,0x03,0x02,0x00};

const char fanzhuan[7]={0x06,0x02,0x03,0x01,0x05,0x004,0x00};

const int time[5]={4000,3200,2400,1600,800}; /*脉冲宽度:0.05m,0.04ms,0.03ms,0.02ms,0.01ms*/

char num; /*将要转动的步数*/

char direct; /*转动方向,0为反转,1为正转*/

char num_run; /*已经转动的步数*/

void main(void)

{

DDRA=0x07;

TCCR1A=0x00;

TCCR1B=0x09;

TIMSK=0x10;

SREG|=0x80;

while(1)

{

;

}

}

#pragma interrupt_handler time1coma:5

void time1coma(void)

{

char i,j;

if(num>9)

{

if(num_run5) OCR1A=time[num_run]; /*增速*/

else if(num_run>(num-5)) OCR1A=time[num-num_run]; /*减速*/

}

else

{

i=(num+1)/2;

if(num_run(i)) OCR1A=time[num_run]; /*增速*/

else OCR1A=time[num-num_run]; /*减速*/

}

if(num_runnum)

{

j=num_run%6;

if(direct==1) PORTA=zhzhuan[j];

else PORTA=fanzhuan[j];

num_run+=1;

}

else

{

OCR1A=0x0fa0;

}

}



关键词: 控制 电机 步进 三相

评论


相关推荐

技术专区

关闭