马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
<p>本帖介绍如何使用配置使用英威腾AX系列PLC本体上的IO的使用方法</p><p>一、输出点配置</p><p>输出端口可以设置为 3 种功能,分别是:普通输出功能、高速脉冲输出功能和比较输出功能,可以通过配置Out0_Confguer来配置输出点,如下图所示,通过对对应变量赋值来对输出点的功能配置。</p><p>当端口配置为0时,做普通io使用;<span style="text-wrap: wrap;">当端口配置为1时,做输出做高速脉冲输出使用;<span style="text-wrap: wrap;">当端口配置为2时做比较输出功能使用。</span></span></p><p><br/></p><p><img src="/upload/article/20231123/1700718696228962.png" title="1700718696228962.png" alt="image.png"/> </p><p><img src="/upload/article/20231123/1700718644828346.png" title="1700718644828346.png" alt="image.png" width="655" height="493" style="width: 655px; height: 493px;"/></p><p><br/></p><p>二、功能块使用</p><p> 以下时英威腾脉冲功能块的说明<br/></p><p><img src="/upload/article/20231123/1700720193444837.png" title="1700720193444837.png" alt="image.png"/></p><p><img src="/upload/article/20231123/1700720224703931.png" title="1700720224703931.png" alt="image.png"/></p><p> 三、例程</p><p><span style="text-wrap: nowrap;">PROGRAM HSIO_shuchu</span></p><p><span style="text-wrap: nowrap;">VAR</span></p><p><span style="text-wrap: nowrap;">//功能块</span></p><p><span style="text-wrap: nowrap;">MC_InitSys_Invt_0 : MC_InitSys_Invt; //轴初始化定义</span></p><p><span style="text-wrap: nowrap;">MC_Axis_0 : MC_Axis; //输出通道轴定义,轴名称</span></p><p><span style="text-wrap: nowrap;">MC_Power_Invt_0 : MC_Power_Invt; //轴使能</span></p><p><span style="text-wrap: nowrap;">MC_MoveVelocity_Invt_0:MC_MoveVelocity_Invt;//轴运动</span></p><p><span style="text-wrap: nowrap;">MC_Stop_Invt_0 : MC_Stop_Invt; //轴停止</span></p><p><span style="text-wrap: nowrap;">MC_Reset_Invt_0 : MC_Reset_Invt; //轴复位</span></p><p><span style="text-wrap: nowrap;">MC_SendData_Invt_0 : MC_SendData_Invt; //数据输出</span></p><p><span style="text-wrap: nowrap;">MC_ReadStatus_Invt_0: MC_ReadStatus_Invt;//轴状态</span></p><p><span style="text-wrap: nowrap;">//变量</span></p><p><span style="text-wrap: nowrap;">Enable_power : BOOL; //轴使能</span></p><p><span style="text-wrap: nowrap;">Enable_Move : BOOL; //轴运动</span></p><p><span style="text-wrap: nowrap;">Enable_stop : BOOL; //轴停止</span></p><p><span style="text-wrap: nowrap;">Enable_reset : BOOL; //轴复位</span></p><p><span style="text-wrap: nowrap;">Enable_Status : BOOL; //轴状态</span></p><p><span style="text-wrap: nowrap;">Pluse_velocity : UDINT; //轴下发脉冲速度</span></p><p><span style="text-wrap: nowrap;">velocity1 : UDINT; //下发转速</span></p><p><span style="text-wrap: nowrap;">END_VAR</span></p><p><span style="text-wrap: nowrap;">//输出通道配置完成后,库管理器调用 高速计数功能块库 CmpHSIO_C.library和 运动控制功能块库 CmpHSIO_M.library</span></p><p><span style="text-wrap: nowrap;"><br/></span></p><p><span style="text-wrap: nowrap;">//轴初始化定义</span></p><p><span style="text-wrap: nowrap;">MC_InitSys_Invt_0(</span></p><p> <span style="text-wrap: nowrap;">Mode:= TRUE, //TRUE脉冲型,FAlSE非脉冲型</span></p><p> <span style="text-wrap: nowrap;">Period:= 4, //运行周期,需要和任务周期Task保持一致</span></p><p> <span style="text-wrap: nowrap;">Done=> , //初始化完成信号</span></p><p> <span style="text-wrap: nowrap;">Error=> , //错误</span></p><p> <span style="text-wrap: nowrap;">ErrorID=> ); //功能块错误码</span></p><p><span style="text-wrap: nowrap;"><br/></span></p><p><span style="text-wrap: nowrap;">//输出通道轴定义</span></p><p><span style="text-wrap: nowrap;">MC_Axis_0(</span></p><p> <span style="text-wrap: nowrap;">AxisID:= 0, //输出通道选择,YO脉冲输出,Y1方向输出,禁止重复定义</span></p><p> <span style="text-wrap: nowrap;">MaxVelocity:=5000 , //输出最大速度,默认5000mm/min</span></p><p> <span style="text-wrap: nowrap;">MaxAcceleration:=180000 , //输出最大加速度,默认180 0000</span></p><p> <span style="text-wrap: nowrap;">MaxHomeSpeed:= , //输出最大回零速度,默认值3000mm/min</span></p><p> <span style="text-wrap: nowrap;">MaxVim2Speed:= , //当前轴第二阶段最大回零速度,默认值20mm/min,可选择默认值不填写</span></p><p> <span style="text-wrap: nowrap;">MaxVim1Speed:= , //当前轴第一阶段最大回零速度,默认值200mm/min,可选择默认值不填写</span></p><p> <span style="text-wrap: nowrap;">MaxJogSpeed:= , //输出最大手动速度,默认值5000mm/min</span></p><p> <span style="text-wrap: nowrap;">LimitEnable:= , //软限位使能标志,TRUE软限位开启,FAlSE软限位关闭,可选择默认值不填写</span></p><p> <span style="text-wrap: nowrap;">MaxPLimit:= , //当前轴最大正限位位置,默认值9999999999.99,可选择默认值不填写</span></p><p> <span style="text-wrap: nowrap;">MaxNLimit:= , //当前轴最大负限位位置,默认值-9999999999.99,可选择默认值不填写</span></p><p> <span style="text-wrap: nowrap;">PulseData:=10000 , //转动一圈脉冲数,需与伺服内部参数保持一致</span></p><p> <span style="text-wrap: nowrap;">DistanceData:= 10, //轴转动一圈周长</span></p><p> <span style="text-wrap: nowrap;">MaxJerkTime:= , //当前轴最大允许加速度变化时间,默认值100,可选择默认值不填写</span></p><p> <span style="text-wrap: nowrap;">Mode:= 0, //轴脉冲控制方式(0:脉冲+方向,1:正反转, 2:正交)</span></p><p> <span style="text-wrap: nowrap;">Error=> , </span></p><p> <span style="text-wrap: nowrap;">ErrorID=> );</span></p><p> </p><p><span style="text-wrap: nowrap;">//轴使能</span></p><p><span style="text-wrap: nowrap;">MC_Power_Invt_0(</span></p><p> <span style="text-wrap: nowrap;">Axis:= MC_Axis_0, //调用轴定义名称,对应输出通道Y0,Y1</span></p><p> <span style="text-wrap: nowrap;">Enable:= Enable_power, //轴使能,高电平有效</span></p><p> <span style="text-wrap: nowrap;">AxisError:= FALSE, //TRUE轴报警,FAlSE轴未报警</span></p><p> <span style="text-wrap: nowrap;">AxisEnable:= MC_InitSys_Invt_0.Done, //轴初始化是否完成</span></p><p> <span style="text-wrap: nowrap;">Status=> , </span></p><p> <span style="text-wrap: nowrap;">Valid=> , //TRUE轴使能有效,FAlSE轴使能无效</span></p><p> <span style="text-wrap: nowrap;">Busy=> , </span></p><p> <span style="text-wrap: nowrap;">Error=> , </span></p><p> <span style="text-wrap: nowrap;">ErrorID=> );</span></p><p><span style="text-wrap: nowrap;"><br/></span></p><p><span style="text-wrap: nowrap;">//轴运动</span></p><p><span style="text-wrap: nowrap;">MC_MoveVelocity_Invt_0(</span></p><p> <span style="text-wrap: nowrap;">Axis:= MC_Axis_0, //调用轴定义名称,对应输出通道Y0,Y1</span></p><p> <span style="text-wrap: nowrap;">Enable:= Enable_Move, //轴运行,上升沿触发</span></p><p> <span style="text-wrap: nowrap;">Direction:= TRUE, //轴运行方向</span></p><p> <span style="text-wrap: nowrap;">Velocity:= 100, //轴运行速度,运行单位mm/min</span></p><p> <span style="text-wrap: nowrap;">Acceleration:=10000 , //加速度大小</span></p><p> <span style="text-wrap: nowrap;">JerkTime:= 10, //允许加速度变化时间</span></p><p> <span style="text-wrap: nowrap;">InVelocity=> , </span></p><p> <span style="text-wrap: nowrap;">Busy=> , </span></p><p> <span style="text-wrap: nowrap;">CommandAborted=> , </span></p><p> <span style="text-wrap: nowrap;">Error=> , </span></p><p> <span style="text-wrap: nowrap;">ErrorID=> );</span></p><p><span style="text-wrap: nowrap;"><br/></span></p><p><span style="text-wrap: nowrap;">//轴停止</span></p><p><span style="text-wrap: nowrap;">MC_Stop_Invt_0(</span></p><p> <span style="text-wrap: nowrap;">Axis:= MC_Axis_0, //调用轴定义名称,对应输出通道Y0,Y1</span></p><p> <span style="text-wrap: nowrap;">Enable:= Enable_stop, //轴运行,上升沿触发</span></p><p> <span style="text-wrap: nowrap;">Deceleration:=100000 , //减速度大小</span></p><p> <span style="text-wrap: nowrap;">Mode:=FALSE , //TRUE减速停,FAlSE立即停止</span></p><p> <span style="text-wrap: nowrap;">Done=> , </span></p><p> <span style="text-wrap: nowrap;">Busy=> , </span></p><p> <span style="text-wrap: nowrap;">Error=> , </span></p><p> <span style="text-wrap: nowrap;">ErrorID=> );</span></p><p> </p><p><span style="text-wrap: nowrap;">//轴复位</span></p><p><span style="text-wrap: nowrap;">MC_Reset_Invt_0(</span></p><p> <span style="text-wrap: nowrap;">Axis:= MC_Axis_0, //调用轴定义名称,对应输出通道Y0,Y1</span></p><p> <span style="text-wrap: nowrap;">Enable:= Enable_reset, //轴复位,上升沿触发</span></p><p> <span style="text-wrap: nowrap;">Done=> , </span></p><p> <span style="text-wrap: nowrap;">Busy=> , </span></p><p> <span style="text-wrap: nowrap;">Error=> , </span></p><p> <span style="text-wrap: nowrap;">ErrorID=> );</span></p><p></p><p></p> |