极客工坊

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 12996|回复: 2

工业步进电机转速控制问题

[复制链接]
发表于 2017-11-29 16:00:44 | 显示全部楼层 |阅读模式
背景:想要使得步进电机每分钟4转,通过设置驱动器拨码开关得到电机每转脉冲为1600,这样算得每个脉冲的延续时间即为60/(4*1600),高低电平各是它的一半,为4688us,但是通过arduino写入程序,程序如图一所示,电机无法启动。若将motorRotationSpeed函数中的time变量变成50us,则可以正常启动,笔者试验过几次,直到80us时也还可以正常启动,但到100us就堵转了,请教各位大神,这到底是怎么回事?有什么解决办法呢?被此问题折磨好几天了...

程序中,PUL_1接步进电机PUL-端,DIR_1接DIR-端子。

  1. int PUL_1=2;
  2. int DIR_1=4;

  3. void setup() {
  4.   // put your setup code here, to run once:
  5.   pinMode(DIR_1,OUTPUT);
  6.   pinMode(PUL_1,OUTPUT);
  7. }

  8. void motorRotationSpeed(unsigned long stepMotorResolution,unsigned int time)
  9. {      
  10.       
  11.      
  12.       while(stepMotorResolution>=0)
  13.       {
  14.             digitalWrite(PUL_1,HIGH);
  15.             delayMicroseconds(time);
  16.             digitalWrite(PUL_1,LOW);
  17.             delayMicroseconds(time);

  18.             stepMotorResolution--;  
  19.         }     
  20.   }

  21. void loop() {
  22.   // put your main code here, to run repeatedly:
  23.    digitalWrite(DIR_1,HIGH);
  24.    int i;
  25.    for(i=1;i<=90;i++)
  26.     {
  27.        motorRotationSpeed(1600,50*i);
  28.        delay(1000);
  29.       }
  30.       
  31.     while(1)
  32.     {
  33.       motorRotationSpeed(1600,4688);
  34.       }
  35. }
复制代码
回复

使用道具 举报

发表于 2017-11-29 19:36:37 来自手机 | 显示全部楼层
我记得一般驱动器都有个最低输入信号频率的
回复 支持 反对

使用道具 举报

发表于 2017-11-30 12:15:43 | 显示全部楼层
你到80us时,电机转速目测是多少?
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则 需要先绑定手机号

Archiver|联系我们|极客工坊

GMT+8, 2024-4-19 19:52 , Processed in 0.035940 second(s), 19 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表