ProCon说明   快速入门   运动控制   EtherCAT   实时程序   API函数   控件库   硬件说明   问题排查   示例代码  
  

位置切速度运动

本节主要介绍内容如下:


       注意
        


相关函数

          

YKM_MoveContinuesRelative 连续运动:相对模式
YKM_MoveContinuesVelocity 连续运动:速度模式
YKM_MoveContinuesInput 连续运动:数字输入

运动说明

        

该功能可用于皮带送料,先启动相对运动一定距离,通过输入信号检测到产品取走切换成速度运动。



       注意
        


流程图

        



程序编写

          

RetCode result;
int exit_cmd = 0;
UINT32 axisIndex = 0;
UINT32 axisIndex = 0;

//库加载
result = YKM_LoadLib();
YKM_BusInfo busInfo;

//等待系统初始化完成
while (!exit_cmd)
{
  result = YKM_GetBusInfo(&busInfo);
  if (busInfo.running)
    break;
  Sleep(100);
}

//设置相对运动参数
YKM_MoveRelativeConfig moveRelativeCfg;
memset(&moveRelativeCfg, 0, sizeof(YKM_MoveRelativeConfig));
moveRelativeCfg.distance = 200;
moveRelativeCfg.acceleration = 1000;
moveRelativeCfg.deceleration = 1000;
moveRelativeCfg.jerk = 10000;
moveRelativeCfg.velocity = 100;

//设置速度运动参数
YKM_MoveVelocityConfig moveVelocityConfig;;
moveVelocityConfig.direction = YKM_DIRECTION::YKM_DIRECTION_POSITIVE;
moveVelocityConfig.acceleration = 1000;
moveVelocityConfig.deceleration = 1000;
moveVelocityConfig.jerk = 10000;
moveVelocityConfig.velocity = 50;

//设置输入信号参数
UINT32 byteIndex = 0, bitIndex = 0;

//相对定位
result = YKM_MoveContinuesRelative(axisIndex, moveRelativeCfg, YKM_BufferMode::YKM_BLENDING_PREV);
print(result);

//输入信号,收到输入信号后切换到下一条指令中去,如果没收到信号,则相对定位完成后就结束了
result = YKM_MoveContinuesInput(axisIndex, byteIndex, bitIndex, YKM_TrigMode::YKM_TRIGMODE_UPEDGE);
print(result);

//速度运动
result = YKM_MoveContinuesVelocity(axisIndex, moveVelocityConfig, YKM_BufferMode::YKM_BLENDING_PREV);
print(result);

YKM_MoveContinuesStart(axisIndex);


常见问题及说明

          

 

  
Copyright © 2015 深圳市优易控软件有限公司 www.proutech.com