多工位正负压热成型机

前言

在潮汕的轻工业中,有一种机型成为多工位正负压热成型机。笔者有幸参与了一个项目的开发。利用这个项目进行基于模块化,功能块化的开发思路,并把OMAC提倡的PackML也考虑在里面进行开发。

多工位正负压热成型机

大概配置:

  • 运动控制器DVP15MC11T
  • DVP04TC-S
  • DVP16SM
  • DVP16SN
  • 伺服A2-M
  • 送片
  • 拉伸
  • 上成型
  • 下成型
  • 上冲剪
  • 下冲剪
  • 堆叠
  • 变频器MH300
  • 输送带
  • 收卷
  • 温控模块DTE
  • DTE10T
  • DTE20T
  • DTE20V
  • 触摸屏10寸

主控DVP15/50MC

伺服轴A2-M/E

程序:

  • Pro_ExChange
  • Pro_AxisBasicControl
  • Pro_Encoder
  • Pro_Logic
  • Pro_Auto
  • Pro_Alarm
  • Pro_TempControl

全局变量声明:

Pro_ExChange

FOR g_Usi_AxisNumber := 1 TO 7 BY 1 DO 
    IF Pro_AxisBasicControl.ActionAxisBasicControl[g_Usi_AxisNumber].uMC_ReadStatus.Standstill THEN
        g_Ui_AxisState[g_Usi_AxisNumber] := 1 ;
    ELSIF Pro_AxisBasicControl.ActionAxisBasicControl[g_Usi_AxisNumber].uMC_ReadStatus.Stopping THEN
        g_Ui_AxisState[g_Usi_AxisNumber] := 2 ;
    ELSIF Pro_AxisBasicControl.ActionAxisBasicControl[g_Usi_AxisNumber].uMC_ReadStatus.ErrorStop THEN
        g_Ui_AxisState[g_Usi_AxisNumber] := 3 ;
    ELSIF Pro_AxisBasicControl.ActionAxisBasicControl[g_Usi_AxisNumber].uMC_ReadStatus.Homing THEN
        g_Ui_AxisState[g_Usi_AxisNumber] := 4 ;
    ELSIF Pro_AxisBasicControl.ActionAxisBasicControl[g_Usi_AxisNumber].uMC_ReadStatus.DiscreteMotion THEN
        g_Ui_AxisState[g_Usi_AxisNumber] := 5 ;
    ELSIF Pro_AxisBasicControl.ActionAxisBasicControl[g_Usi_AxisNumber].uMC_ReadStatus.ContinuousMotion THEN
        g_Ui_AxisState[g_Usi_AxisNumber] := 6 ;
    ELSIF Pro_AxisBasicControl.ActionAxisBasicControl[g_Usi_AxisNumber].uMC_ReadStatus.SyncMotion THEN
        g_Ui_AxisState[g_Usi_AxisNumber] := 7 ;
    ELSE
        g_Ui_AxisState[g_Usi_AxisNumber] := 0 ;
    END_IF;
    g_r_AxisActCur[g_Usi_AxisNumber]   := LREAL_TO_REAL(In:= Axis[g_Usi_AxisNumber].ActCur );
    g_r_AxisActTrq[g_Usi_AxisNumber]   := LREAL_TO_REAL(In:= Axis[g_Usi_AxisNumber].ActTrq );
    g_Ui_AxisErrorID[g_Usi_AxisNumber] := Pro_AxisBasicControl.ActionAxisBasicControl[g_Usi_AxisNumber].uMC_ReadAxisError.AxisErrorID ;
END_FOR;
//轴位置或角度
g_r_AxisActPos[1] := LREAL_TO_REAL(In:= Pro_AxisBasicControl.ActionAxisBasicControl[1].uMC_ReadActualPosition.Position);
g_r_AxisActPos[2] := LREAL_TO_REAL(In:= Pro_AxisBasicControl.ActionAxisBasicControl[2].uMC_ReadActualPosition.Position);
g_r_AxisActPos[3] := LREAL_TO_REAL(In:= MODABS(In1:= Pro_AxisBasicControl.ActionAxisBasicControl[3].uMC_ReadActualPosition.Position ,In2:= 36000 ));
g_r_AxisActPos[4] := LREAL_TO_REAL(In:= MODABS(In1:= Pro_AxisBasicControl.ActionAxisBasicControl[4].uMC_ReadActualPosition.Position ,In2:= 36000 ));
g_r_AxisActPos[5] := LREAL_TO_REAL(In:= MODABS(In1:= Pro_AxisBasicControl.ActionAxisBasicControl[5].uMC_ReadActualPosition.Position ,In2:= 36000 ));
g_r_AxisActPos[6] := LREAL_TO_REAL(In:= MODABS(In1:= Pro_AxisBasicControl.ActionAxisBasicControl[6].uMC_ReadActualPosition.Position ,In2:= 36000 ));
g_r_AxisActPos[7] := LREAL_TO_REAL(In:= Pro_AxisBasicControl.ActionAxisBasicControl[7].uMC_ReadActualPosition.Position);

uCANmotion_NodeDiag[1](SlaveNode:= 1);
uCANmotion_NodeDiag[2](SlaveNode:= 2);
uCANmotion_NodeDiag[3](SlaveNode:= 3);
uCANmotion_NodeDiag[4](SlaveNode:= 4);
uCANmotion_NodeDiag[5](SlaveNode:= 5);
uCANmotion_NodeDiag[6](SlaveNode:= 6);
uCANmotion_NodeDiag[7](SlaveNode:= 7);
uCANopen_NodeDiag[1](Enable:= TRUE, SlaveNode:= 1 );
uCANopen_NodeDiag[2](Enable:= TRUE, SlaveNode:= 2 );
//网络诊断
IF (uCANmotion_NodeDiag[1].NodeOffline = FALSE) AND
    (uCANmotion_NodeDiag[2].NodeOffline = FALSE) AND
    (uCANmotion_NodeDiag[3].NodeOffline = FALSE) AND
    (uCANmotion_NodeDiag[4].NodeOffline = FALSE) AND
    (uCANmotion_NodeDiag[5].NodeOffline = FALSE) AND
    (uCANmotion_NodeDiag[6].NodeOffline = FALSE) AND
    (uCANmotion_NodeDiag[7].NodeOffline = FALSE) AND
    uCANopen_NodeDiag[1].InitSuccess AND uCANopen_NodeDiag[2].InitSuccess THEN
    g_b_SystemNetOK := TRUE ;
ELSE
    g_b_SystemNetOK := FALSE ;
END_IF;

FB_AxisBasicControl功能块

变量声明:

范围 名称 地址 数据类型 初始值 注释
VAR uMC_Power MC_Power
VAR uMC_Home MC_Home
VAR uMC_Stop MC_Stop
VAR uMC_Reset MC_Reset
VAR uMC_MoveRelative MC_MoveRelative
VAR uMC_MoveAbsolute MC_MoveAbsolute
VAR uMC_ReadAxisError MC_ReadAxisError
VAR uMC_ReadStatus MC_ReadStatus
VAR uMC_ReadActualPosition MC_ReadActualPosition
VAR uMC_SetOverride MC_SetOverride
VAR uDMC_Jog DMC_Jog
VAR uDMC_MoveVelocity DMC_MoveVelocity
VAR_INPUT UsiAxisNumber USINT

程序内容:

uMC_Power(EN:=TRUE ,Axis:= UsiAxisNumber,BufferMode:= mcAborting,);
uMC_Home(EN:= TRUE,Axis:= UsiAxisNumber,BufferMode:= mcAborting);
uMC_Stop(EN:= TRUE,Axis:= UsiAxisNumber);
uMC_Reset(EN:= TRUE,Axis:= UsiAxisNumber);
uMC_MoveRelative(EN:= TRUE,Axis:= UsiAxisNumber,BufferMode:= mcAborting);
uMC_MoveAbsolute(EN:= TRUE,Axis:= UsiAxisNumber,BufferMode:= mcAborting);
uMC_SetOverride(EN:= TRUE,Axis:= UsiAxisNumber);
uMC_ReadAxisError(EN:= TRUE,Axis:= UsiAxisNumber,Enable:= TRUE);    
uMC_ReadStatus(EN:= TRUE,Axis:= UsiAxisNumber,Enable:= TRUE );
uMC_ReadActualPosition(EN:= TRUE ,Axis:= UsiAxisNumber,Enable:= TRUE);
uDMC_Jog(Axis:= UsiAxisNumber);
uDMC_MoveVelocity(Axis:= UsiAxisNumber,BufferMode:= mcAborting);

Pro_AxisBasicControl

变量声明:

范围 名称 地址 数据类型 初始值 注释
VAR ActionAxisBasicControl ARRAY[1..7] OF FB_AxisBasicControl
VAR UsiAxis USINT

程序内容:

ActionAxisBasicControl[1].UsiAxisNumber := 1 ;
ActionAxisBasicControl[2].UsiAxisNumber := 2 ;
ActionAxisBasicControl[3].UsiAxisNumber := 3 ;
ActionAxisBasicControl[4].UsiAxisNumber := 4 ;
ActionAxisBasicControl[5].UsiAxisNumber := 5 ;
ActionAxisBasicControl[6].UsiAxisNumber := 6 ;
ActionAxisBasicControl[7].UsiAxisNumber := 7 ;

ActionAxisBasicControl[1].uMC_Home.Position := 0.0 ;
ActionAxisBasicControl[2].uMC_Home.Position := 0.0 ;
ActionAxisBasicControl[3].uMC_Home.Position := 0.0 ;
ActionAxisBasicControl[4].uMC_Home.Position := 0.0 ;
ActionAxisBasicControl[5].uMC_Home.Position := 0.0 ;
ActionAxisBasicControl[6].uMC_Home.Position := 0.0 ;
ActionAxisBasicControl[7].uMC_Home.Position := 0.0 ;

ActionAxisBasicControl[1].uDMC_Jog.Acceleration := REAL_TO_LREAL(In:= (g_r_AxisMotorSpeed[1]/(g_r_InputRotation[1]/g_r_OutputRotation[1])*(g_r_UnitsPerRotation[1]*3.141592)/60) / g_r_AxisAcc[1] * 2 );
ActionAxisBasicControl[2].uDMC_Jog.Acceleration := REAL_TO_LREAL(In:= (g_r_AxisMotorSpeed[2]/(g_r_InputRotation[2]/g_r_OutputRotation[2])*(g_r_UnitsPerRotation[2]*3.141592)/60) / g_r_AxisAcc[2] * 2 );
ActionAxisBasicControl[3].uDMC_Jog.Acceleration := REAL_TO_LREAL(In:= g_r_AxisMotorSpeed[3]/(g_r_InputRotation[3]/g_r_OutputRotation[3])*600 / g_r_AxisAcc[3] * 2 );
ActionAxisBasicControl[4].uDMC_Jog.Acceleration := REAL_TO_LREAL(In:= g_r_AxisMotorSpeed[4]/(g_r_InputRotation[4]/g_r_OutputRotation[4])*600 / g_r_AxisAcc[4] * 2 );
ActionAxisBasicControl[5].uDMC_Jog.Acceleration := REAL_TO_LREAL(In:= g_r_AxisMotorSpeed[5]/(g_r_InputRotation[5]/g_r_OutputRotation[5])*600 / g_r_AxisAcc[5] * 2 );
ActionAxisBasicControl[6].uDMC_Jog.Acceleration := REAL_TO_LREAL(In:= g_r_AxisMotorSpeed[6]/(g_r_InputRotation[6]/g_r_OutputRotation[6])*600 / g_r_AxisAcc[6] * 2 );
ActionAxisBasicControl[7].uDMC_Jog.Acceleration := REAL_TO_LREAL(In:= (g_r_AxisMotorSpeed[7]/(g_r_InputRotation[7]/g_r_OutputRotation[7])*(g_r_UnitsPerRotation[7]*3.141592)/60) / g_r_AxisAcc[7] * 2 );
ActionAxisBasicControl[1].uDMC_Jog.Deceleration := REAL_TO_LREAL(In:= (g_r_AxisMotorSpeed[1]/(g_r_InputRotation[1]/g_r_OutputRotation[1])*(g_r_UnitsPerRotation[1]*3.141592)/60) / g_r_AxisDec[1] * 2 );
ActionAxisBasicControl[2].uDMC_Jog.Deceleration := REAL_TO_LREAL(In:= (g_r_AxisMotorSpeed[2]/(g_r_InputRotation[2]/g_r_OutputRotation[2])*(g_r_UnitsPerRotation[2]*3.141592)/60) / g_r_AxisDec[2] * 2 );
ActionAxisBasicControl[3].uDMC_Jog.Deceleration := REAL_TO_LREAL(In:= g_r_AxisMotorSpeed[3]/(g_r_InputRotation[3]/g_r_OutputRotation[3])*600 / g_r_AxisDec[3] * 2 );
ActionAxisBasicControl[4].uDMC_Jog.Deceleration := REAL_TO_LREAL(In:= g_r_AxisMotorSpeed[4]/(g_r_InputRotation[4]/g_r_OutputRotation[4])*600 / g_r_AxisDec[4] * 2 );
ActionAxisBasicControl[5].uDMC_Jog.Deceleration := REAL_TO_LREAL(In:= g_r_AxisMotorSpeed[5]/(g_r_InputRotation[5]/g_r_OutputRotation[5])*600 / g_r_AxisDec[5] * 2 );
ActionAxisBasicControl[6].uDMC_Jog.Deceleration := REAL_TO_LREAL(In:= g_r_AxisMotorSpeed[6]/(g_r_InputRotation[6]/g_r_OutputRotation[6])*600 / g_r_AxisDec[6] * 2 );
ActionAxisBasicControl[7].uDMC_Jog.Deceleration := REAL_TO_LREAL(In:= (g_r_AxisMotorSpeed[7]/(g_r_InputRotation[7]/g_r_OutputRotation[7])*(g_r_UnitsPerRotation[7]*3.141592)/60) / g_r_AxisDec[7] * 2 );
ActionAxisBasicControl[1].uDMC_Jog.Jerk         := REAL_TO_LREAL(In:= (g_r_AxisMotorSpeed[1]/(g_r_InputRotation[1]/g_r_OutputRotation[1])*(g_r_UnitsPerRotation[1]*3.141592)/60) / g_r_AxisAcc[1] * 2 / g_r_AxisAcc[1] * 2);
ActionAxisBasicControl[2].uDMC_Jog.Jerk         := REAL_TO_LREAL(In:= (g_r_AxisMotorSpeed[2]/(g_r_InputRotation[2]/g_r_OutputRotation[2])*(g_r_UnitsPerRotation[2]*3.141592)/60) / g_r_AxisAcc[2] * 2 / g_r_AxisAcc[2] * 2);
ActionAxisBasicControl[3].uDMC_Jog.Jerk         := REAL_TO_LREAL(In:= g_r_AxisMotorSpeed[3]/(g_r_InputRotation[3]/g_r_OutputRotation[3])*600 / g_r_AxisAcc[3] * 2 / g_r_AxisAcc[3] * 2 );
ActionAxisBasicControl[4].uDMC_Jog.Jerk         := REAL_TO_LREAL(In:= g_r_AxisMotorSpeed[4]/(g_r_InputRotation[4]/g_r_OutputRotation[4])*600 / g_r_AxisAcc[4] * 2 / g_r_AxisAcc[4] * 2 );
ActionAxisBasicControl[5].uDMC_Jog.Jerk         := REAL_TO_LREAL(In:= g_r_AxisMotorSpeed[5]/(g_r_InputRotation[5]/g_r_OutputRotation[5])*600 / g_r_AxisAcc[5] * 2 / g_r_AxisAcc[5] * 2 );
ActionAxisBasicControl[6].uDMC_Jog.Jerk         := REAL_TO_LREAL(In:= g_r_AxisMotorSpeed[6]/(g_r_InputRotation[6]/g_r_OutputRotation[6])*600 / g_r_AxisAcc[6] * 2 / g_r_AxisAcc[6] * 2 );
ActionAxisBasicControl[7].uDMC_Jog.Jerk         := REAL_TO_LREAL(In:= (g_r_AxisMotorSpeed[7]/(g_r_InputRotation[7]/g_r_OutputRotation[7])*(g_r_UnitsPerRotation[7]*3.141592)/60) / g_r_AxisAcc[7] * 2 / g_r_AxisAcc[7] * 2);
//ActionAxisBasicControl[1].uMC_MoveAbsolute.Acceleration := REAL_TO_LREAL(In:= (g_r_AxisMotorSpeed[1]/(g_r_InputRotation[1]/g_r_OutputRotation[1])*(g_r_UnitsPerRotation[1]*3.141592)/60) / g_r_AxisAcc[1] * 2 );
ActionAxisBasicControl[2].uMC_MoveAbsolute.Acceleration := REAL_TO_LREAL(In:= (g_r_AxisMotorSpeed[2]/(g_r_InputRotation[2]/g_r_OutputRotation[2])*(g_r_UnitsPerRotation[2]*3.141592)/60) / g_r_AxisAcc[2] * 2 );
ActionAxisBasicControl[3].uMC_MoveAbsolute.Acceleration := REAL_TO_LREAL(In:= g_r_AxisMotorSpeed[3]/(g_r_InputRotation[3]/g_r_OutputRotation[3])*600 / g_r_AxisAcc[3] * 2 );
ActionAxisBasicControl[4].uMC_MoveAbsolute.Acceleration := REAL_TO_LREAL(In:= g_r_AxisMotorSpeed[4]/(g_r_InputRotation[4]/g_r_OutputRotation[4])*600 / g_r_AxisAcc[4] * 2 );
ActionAxisBasicControl[5].uMC_MoveAbsolute.Acceleration := REAL_TO_LREAL(In:= g_r_AxisMotorSpeed[5]/(g_r_InputRotation[5]/g_r_OutputRotation[5])*600 / g_r_AxisAcc[5] * 2 );
ActionAxisBasicControl[6].uMC_MoveAbsolute.Acceleration := REAL_TO_LREAL(In:= g_r_AxisMotorSpeed[6]/(g_r_InputRotation[6]/g_r_OutputRotation[6])*600 / g_r_AxisAcc[6] * 2 );
ActionAxisBasicControl[7].uMC_MoveAbsolute.Acceleration := REAL_TO_LREAL(In:= (g_r_AxisMotorSpeed[7]/(g_r_InputRotation[7]/g_r_OutputRotation[7])*(g_r_UnitsPerRotation[7]*3.141592)/60) / g_r_AxisAcc[7] * 2 );
//ActionAxisBasicControl[1].uMC_MoveAbsolute.Deceleration := REAL_TO_LREAL(In:= (g_r_AxisMotorSpeed[1]/(g_r_InputRotation[1]/g_r_OutputRotation[1])*(g_r_UnitsPerRotation[1]*3.141592)/60) / g_r_AxisDec[1] * 2 );
ActionAxisBasicControl[2].uMC_MoveAbsolute.Deceleration := REAL_TO_LREAL(In:= (g_r_AxisMotorSpeed[1]/(g_r_InputRotation[1]/g_r_OutputRotation[1])*(g_r_UnitsPerRotation[1]*3.141592)/60) / g_r_AxisDec[1] * 2 );
ActionAxisBasicControl[3].uMC_MoveAbsolute.Deceleration := REAL_TO_LREAL(In:= g_r_AxisMotorSpeed[3]/(g_r_InputRotation[3]/g_r_OutputRotation[3])*600 / g_r_AxisDec[3] * 2 );
ActionAxisBasicControl[4].uMC_MoveAbsolute.Deceleration := REAL_TO_LREAL(In:= g_r_AxisMotorSpeed[4]/(g_r_InputRotation[4]/g_r_OutputRotation[4])*600 / g_r_AxisDec[4] * 2 );
ActionAxisBasicControl[5].uMC_MoveAbsolute.Deceleration := REAL_TO_LREAL(In:= g_r_AxisMotorSpeed[5]/(g_r_InputRotation[5]/g_r_OutputRotation[5])*600 / g_r_AxisDec[5] * 2 );
ActionAxisBasicControl[6].uMC_MoveAbsolute.Deceleration := REAL_TO_LREAL(In:= g_r_AxisMotorSpeed[6]/(g_r_InputRotation[6]/g_r_OutputRotation[6])*600 / g_r_AxisDec[6] * 2 );
ActionAxisBasicControl[7].uMC_MoveAbsolute.Deceleration := REAL_TO_LREAL(In:= (g_r_AxisMotorSpeed[1]/(g_r_InputRotation[1]/g_r_OutputRotation[1])*(g_r_UnitsPerRotation[1]*3.141592)/60) / g_r_AxisDec[1] * 2 );
//ActionAxisBasicControl[1].uMC_MoveAbsolute.Jerk         := REAL_TO_LREAL(In:= (g_r_AxisMotorSpeed[1]/(g_r_InputRotation[1]/g_r_OutputRotation[1])*(g_r_UnitsPerRotation[1]*3.141592)/60) / g_r_AxisAcc[1] * 2 / g_r_AxisAcc[1] * 2);
ActionAxisBasicControl[2].uMC_MoveAbsolute.Jerk         := REAL_TO_LREAL(In:= (g_r_AxisMotorSpeed[2]/(g_r_InputRotation[2]/g_r_OutputRotation[2])*(g_r_UnitsPerRotation[2]*3.141592)/60) / g_r_AxisAcc[2] * 2 / g_r_AxisAcc[2] * 2);
ActionAxisBasicControl[3].uMC_MoveAbsolute.Jerk         := REAL_TO_LREAL(In:= g_r_AxisMotorSpeed[3]/(g_r_InputRotation[3]/g_r_OutputRotation[3])*600 / g_r_AxisAcc[3] * 2 / g_r_AxisAcc[3] * 2 );
ActionAxisBasicControl[4].uMC_MoveAbsolute.Jerk         := REAL_TO_LREAL(In:= g_r_AxisMotorSpeed[4]/(g_r_InputRotation[4]/g_r_OutputRotation[4])*600 / g_r_AxisAcc[4] * 2 / g_r_AxisAcc[4] * 2 );
ActionAxisBasicControl[5].uMC_MoveAbsolute.Jerk         := REAL_TO_LREAL(In:= g_r_AxisMotorSpeed[5]/(g_r_InputRotation[5]/g_r_OutputRotation[5])*600 / g_r_AxisAcc[5] * 2 / g_r_AxisAcc[5] * 2 );
ActionAxisBasicControl[6].uMC_MoveAbsolute.Jerk         := REAL_TO_LREAL(In:= g_r_AxisMotorSpeed[6]/(g_r_InputRotation[6]/g_r_OutputRotation[6])*600 / g_r_AxisAcc[6] * 2 / g_r_AxisAcc[6] * 2 );
ActionAxisBasicControl[7].uMC_MoveAbsolute.Jerk         := REAL_TO_LREAL(In:= (g_r_AxisMotorSpeed[7]/(g_r_InputRotation[7]/g_r_OutputRotation[7])*(g_r_UnitsPerRotation[7]*3.141592)/60) / g_r_AxisAcc[7] * 2 / g_r_AxisAcc[7] * 2);
ActionAxisBasicControl[1].uMC_MoveRelative.Acceleration := REAL_TO_LREAL(In:= (g_r_AxisMotorSpeed[1]/(g_r_InputRotation[1]/g_r_OutputRotation[1])*(g_r_UnitsPerRotation[1]*3.141592)/60) / g_r_AxisAcc[1] * 2 );
//ActionAxisBasicControl[2].uMC_MoveRelative.Acceleration := REAL_TO_LREAL(In:= (g_r_AxisMotorSpeed[2]/(g_r_InputRotation[2]/g_r_OutputRotation[2])*(g_r_UnitsPerRotation[2]*3.141592)/60) / g_r_AxisAcc[2] * 2 );
//ActionAxisBasicControl[3].uMC_MoveRelative.Acceleration := REAL_TO_LREAL(In:= g_r_AxisMotorSpeed[3]/(g_r_InputRotation[3]/g_r_OutputRotation[3])*600 / g_r_AxisAcc[3] * 2 );
//ActionAxisBasicControl[4].uMC_MoveRelative.Acceleration := REAL_TO_LREAL(In:= g_r_AxisMotorSpeed[4]/(g_r_InputRotation[4]/g_r_OutputRotation[4])*600 / g_r_AxisAcc[4] * 2 );
//ActionAxisBasicControl[5].uMC_MoveRelative.Acceleration := REAL_TO_LREAL(In:= g_r_AxisMotorSpeed[5]/(g_r_InputRotation[5]/g_r_OutputRotation[5])*600 / g_r_AxisAcc[5] * 2 );
//ActionAxisBasicControl[6].uMC_MoveRelative.Acceleration := REAL_TO_LREAL(In:= g_r_AxisMotorSpeed[6]/(g_r_InputRotation[6]/g_r_OutputRotation[6])*600 / g_r_AxisAcc[6] * 2 );
//ActionAxisBasicControl[7].uMC_MoveRelative.Acceleration := REAL_TO_LREAL(In:= (g_r_AxisMotorSpeed[7]/(g_r_InputRotation[7]/g_r_OutputRotation[7])*(g_r_UnitsPerRotation[7]*3.141592)/60) / g_r_AxisAcc[7] * 2 );
ActionAxisBasicControl[1].uMC_MoveRelative.Deceleration := REAL_TO_LREAL(In:= (g_r_AxisMotorSpeed[1]/(g_r_InputRotation[1]/g_r_OutputRotation[1])*(g_r_UnitsPerRotation[1]*3.141592)/60) / g_r_AxisDec[1] * 2 );
//ActionAxisBasicControl[2].uMC_MoveRelative.Deceleration := REAL_TO_LREAL(In:= (g_r_AxisMotorSpeed[1]/(g_r_InputRotation[1]/g_r_OutputRotation[1])*(g_r_UnitsPerRotation[1]*3.141592)/60) / g_r_AxisDec[1] * 2 );
//ActionAxisBasicControl[3].uMC_MoveRelative.Deceleration := REAL_TO_LREAL(In:= g_r_AxisMotorSpeed[3]/(g_r_InputRotation[3]/g_r_OutputRotation[3])*600 / g_r_AxisDec[3] * 2 );
//ActionAxisBasicControl[4].uMC_MoveRelative.Deceleration := REAL_TO_LREAL(In:= g_r_AxisMotorSpeed[4]/(g_r_InputRotation[4]/g_r_OutputRotation[4])*600 / g_r_AxisDec[4] * 2 );
//ActionAxisBasicControl[5].uMC_MoveRelative.Deceleration := REAL_TO_LREAL(In:= g_r_AxisMotorSpeed[5]/(g_r_InputRotation[5]/g_r_OutputRotation[5])*600 / g_r_AxisDec[5] * 2 );
//ActionAxisBasicControl[6].uMC_MoveRelative.Deceleration := REAL_TO_LREAL(In:= g_r_AxisMotorSpeed[6]/(g_r_InputRotation[6]/g_r_OutputRotation[6])*600 / g_r_AxisDec[6] * 2 );
//ActionAxisBasicControl[7].uMC_MoveRelative.Deceleration := REAL_TO_LREAL(In:= (g_r_AxisMotorSpeed[1]/(g_r_InputRotation[1]/g_r_OutputRotation[1])*(g_r_UnitsPerRotation[1]*3.141592)/60) / g_r_AxisDec[1] * 2 );
ActionAxisBasicControl[1].uMC_MoveRelative.Jerk         := REAL_TO_LREAL(In:= (g_r_AxisMotorSpeed[1]/(g_r_InputRotation[1]/g_r_OutputRotation[1])*(g_r_UnitsPerRotation[1]*3.141592)/60) / g_r_AxisAcc[1] * 2 / g_r_AxisAcc[1] * 2);
//ActionAxisBasicControl[2].uMC_MoveRelative.Jerk         := REAL_TO_LREAL(In:= (g_r_AxisMotorSpeed[2]/(g_r_InputRotation[2]/g_r_OutputRotation[2])*(g_r_UnitsPerRotation[2]*3.141592)/60) / g_r_AxisAcc[2] * 2 / g_r_AxisAcc[2] * 2);
//ActionAxisBasicControl[3].uMC_MoveRelative.Jerk         := REAL_TO_LREAL(In:= g_r_AxisMotorSpeed[3]/(g_r_InputRotation[3]/g_r_OutputRotation[3])*600 / g_r_AxisAcc[3] * 2 / g_r_AxisAcc[3] * 2 );
//ActionAxisBasicControl[4].uMC_MoveRelative.Jerk         := REAL_TO_LREAL(In:= g_r_AxisMotorSpeed[4]/(g_r_InputRotation[4]/g_r_OutputRotation[4])*600 / g_r_AxisAcc[4] * 2 / g_r_AxisAcc[4] * 2 );
//ActionAxisBasicControl[5].uMC_MoveRelative.Jerk         := REAL_TO_LREAL(In:= g_r_AxisMotorSpeed[5]/(g_r_InputRotation[5]/g_r_OutputRotation[5])*600 / g_r_AxisAcc[5] * 2 / g_r_AxisAcc[5] * 2 );
//ActionAxisBasicControl[6].uMC_MoveRelative.Jerk         := REAL_TO_LREAL(In:= g_r_AxisMotorSpeed[6]/(g_r_InputRotation[6]/g_r_OutputRotation[6])*600 / g_r_AxisAcc[6] * 2 / g_r_AxisAcc[6] * 2 );
//ActionAxisBasicControl[7].uMC_MoveRelative.Jerk         := REAL_TO_LREAL(In:= (g_r_AxisMotorSpeed[7]/(g_r_InputRotation[7]/g_r_OutputRotation[7])*(g_r_UnitsPerRotation[7]*3.141592)/60) / g_r_AxisAcc[7] * 2 / g_r_AxisAcc[7] * 2);
ActionAxisBasicControl[1].uMC_Stop.Deceleration         := REAL_TO_LREAL(In:= (g_r_AxisMotorSpeed[1]/(g_r_InputRotation[1]/g_r_OutputRotation[1])*(g_r_UnitsPerRotation[1]*3.141592)/60) / g_r_AxisDec[1] * 2 )*10;
ActionAxisBasicControl[2].uMC_Stop.Deceleration         := REAL_TO_LREAL(In:= (g_r_AxisMotorSpeed[1]/(g_r_InputRotation[1]/g_r_OutputRotation[1])*(g_r_UnitsPerRotation[1]*3.141592)/60) / g_r_AxisDec[1] * 2 )*10;
ActionAxisBasicControl[3].uMC_Stop.Deceleration         := REAL_TO_LREAL(In:= g_r_AxisMotorSpeed[3]/(g_r_InputRotation[3]/g_r_OutputRotation[3])*600 / g_r_AxisDec[3] * 2 )*10;
ActionAxisBasicControl[4].uMC_Stop.Deceleration         := REAL_TO_LREAL(In:= g_r_AxisMotorSpeed[4]/(g_r_InputRotation[4]/g_r_OutputRotation[4])*600 / g_r_AxisDec[4] * 2 )*10;
ActionAxisBasicControl[5].uMC_Stop.Deceleration         := REAL_TO_LREAL(In:= g_r_AxisMotorSpeed[5]/(g_r_InputRotation[5]/g_r_OutputRotation[5])*600 / g_r_AxisDec[5] * 2 )*10;
ActionAxisBasicControl[6].uMC_Stop.Deceleration         := REAL_TO_LREAL(In:= g_r_AxisMotorSpeed[6]/(g_r_InputRotation[6]/g_r_OutputRotation[6])*600 / g_r_AxisDec[6] * 2 )*10;
ActionAxisBasicControl[7].uMC_Stop.Deceleration         := REAL_TO_LREAL(In:= (g_r_AxisMotorSpeed[1]/(g_r_InputRotation[1]/g_r_OutputRotation[1])*(g_r_UnitsPerRotation[1]*3.141592)/60) / g_r_AxisDec[1] * 2 )*10;
ActionAxisBasicControl[1].uMC_Stop.Jerk                 := REAL_TO_LREAL(In:= (g_r_AxisMotorSpeed[1]/(g_r_InputRotation[1]/g_r_OutputRotation[1])*(g_r_UnitsPerRotation[1]*3.141592)/60) / g_r_AxisAcc[1] * 2 / g_r_AxisAcc[1] * 2)*10;
ActionAxisBasicControl[2].uMC_Stop.Jerk                 := REAL_TO_LREAL(In:= (g_r_AxisMotorSpeed[2]/(g_r_InputRotation[2]/g_r_OutputRotation[2])*(g_r_UnitsPerRotation[2]*3.141592)/60) / g_r_AxisAcc[2] * 2 / g_r_AxisAcc[2] * 2)*10;
ActionAxisBasicControl[3].uMC_Stop.Jerk                 := REAL_TO_LREAL(In:= g_r_AxisMotorSpeed[3]/(g_r_InputRotation[3]/g_r_OutputRotation[3])*600 / g_r_AxisAcc[3] * 2 / g_r_AxisAcc[3] * 2 )*10;
ActionAxisBasicControl[4].uMC_Stop.Jerk                 := REAL_TO_LREAL(In:= g_r_AxisMotorSpeed[4]/(g_r_InputRotation[4]/g_r_OutputRotation[4])*600 / g_r_AxisAcc[4] * 2 / g_r_AxisAcc[4] * 2 )*10;
ActionAxisBasicControl[5].uMC_Stop.Jerk                 := REAL_TO_LREAL(In:= g_r_AxisMotorSpeed[5]/(g_r_InputRotation[5]/g_r_OutputRotation[5])*600 / g_r_AxisAcc[5] * 2 / g_r_AxisAcc[5] * 2 )*10;
ActionAxisBasicControl[6].uMC_Stop.Jerk                 := REAL_TO_LREAL(In:= g_r_AxisMotorSpeed[6]/(g_r_InputRotation[6]/g_r_OutputRotation[6])*600 / g_r_AxisAcc[6] * 2 / g_r_AxisAcc[6] * 2 )*10;
ActionAxisBasicControl[7].uMC_Stop.Jerk                 := REAL_TO_LREAL(In:= (g_r_AxisMotorSpeed[7]/(g_r_InputRotation[7]/g_r_OutputRotation[7])*(g_r_UnitsPerRotation[7]*3.141592)/60) / g_r_AxisAcc[7] * 2 / g_r_AxisAcc[7] * 2)*10;

ActionAxisBasicControl[1].uDMC_Jog.Velocity             := REAL_TO_LREAL(In:= (g_r_AxisMotorSpeed[1]/(g_r_InputRotation[1]/g_r_OutputRotation[1])*(g_r_UnitsPerRotation[1]*3.141592)/60) / 100 * g_r_AxisJogSpeed[1]) ;
ActionAxisBasicControl[2].uDMC_Jog.Velocity             := REAL_TO_LREAL(In:= (g_r_AxisMotorSpeed[2]/(g_r_InputRotation[2]/g_r_OutputRotation[2])*(g_r_UnitsPerRotation[2]*3.141592)/60) / 100 * g_r_AxisJogSpeed[2]) ;
ActionAxisBasicControl[3].uDMC_Jog.Velocity             := REAL_TO_LREAL(In:= g_r_AxisMotorSpeed[3]/(g_r_InputRotation[3]/g_r_OutputRotation[3])*600 / 100 * g_r_AxisJogSpeed[3] ) ;
ActionAxisBasicControl[4].uDMC_Jog.Velocity             := REAL_TO_LREAL(In:= g_r_AxisMotorSpeed[4]/(g_r_InputRotation[4]/g_r_OutputRotation[4])*600 / 100 * g_r_AxisJogSpeed[4] ) ;
ActionAxisBasicControl[5].uDMC_Jog.Velocity             := REAL_TO_LREAL(In:= g_r_AxisMotorSpeed[5]/(g_r_InputRotation[5]/g_r_OutputRotation[5])*600 / 100 * g_r_AxisJogSpeed[5] ) ;
ActionAxisBasicControl[6].uDMC_Jog.Velocity             := REAL_TO_LREAL(In:= g_r_AxisMotorSpeed[6]/(g_r_InputRotation[6]/g_r_OutputRotation[6])*600 / 100 * g_r_AxisJogSpeed[6] ) ;
ActionAxisBasicControl[7].uDMC_Jog.Velocity             := REAL_TO_LREAL(In:= (g_r_AxisMotorSpeed[7]/(g_r_InputRotation[7]/g_r_OutputRotation[7])*(g_r_UnitsPerRotation[7]*3.141592)/60) / 100 * g_r_AxisJogSpeed[7]) ;

IF g_b_ManualMode THEN
    ActionAxisBasicControl[1].uMC_MoveRelative.Velocity := REAL_TO_LREAL(In:= g_r_AxisMotorSpeed[1]/(g_r_InputRotation[1]/g_r_OutputRotation[1])*(g_r_UnitsPerRotation[1]*3.141592)/60 );
    ActionAxisBasicControl[2].uMC_MoveAbsolute.Velocity := REAL_TO_LREAL(In:= g_r_AxisMotorSpeed[2]/(g_r_InputRotation[2]/g_r_OutputRotation[2])*(g_r_UnitsPerRotation[2]*3.141592)/60 / 100 * g_r_AxisJogSpeed[2] );
    ActionAxisBasicControl[3].uMC_MoveAbsolute.Velocity := REAL_TO_LREAL(In:= g_r_AxisMotorSpeed[3]/(g_r_InputRotation[3]/g_r_OutputRotation[3])*600 / 100 * g_r_AxisJogSpeed[3] ) ;
    ActionAxisBasicControl[4].uMC_MoveAbsolute.Velocity := REAL_TO_LREAL(In:= g_r_AxisMotorSpeed[4]/(g_r_InputRotation[4]/g_r_OutputRotation[4])*600 / 100 * g_r_AxisJogSpeed[4] ) ;
    ActionAxisBasicControl[5].uMC_MoveAbsolute.Velocity := REAL_TO_LREAL(In:= g_r_AxisMotorSpeed[5]/(g_r_InputRotation[5]/g_r_OutputRotation[5])*600 / 100 * g_r_AxisJogSpeed[5] ) ;
    ActionAxisBasicControl[6].uMC_MoveAbsolute.Velocity := REAL_TO_LREAL(In:= g_r_AxisMotorSpeed[6]/(g_r_InputRotation[6]/g_r_OutputRotation[6])*600 / 100 * g_r_AxisJogSpeed[6] ) ;
    ActionAxisBasicControl[7].uMC_MoveAbsolute.Velocity := REAL_TO_LREAL(In:= g_r_AxisMotorSpeed[7]/(g_r_InputRotation[7]/g_r_OutputRotation[7])*(g_r_UnitsPerRotation[7]*3.141592)/60 / 100 * g_r_AxisJogSpeed[7] );
END_IF;

//使能
IF g_b_SystemNetOk AND g_b_OneKeyEnable THEN
    FOR UsiAxis := 1 TO 7 BY 1 DO 
        ActionAxisBasicControl[UsiAxis].uMC_Power.Enable         := g_b_AxisEnable[UsiAxis] ;
        ActionAxisBasicControl[UsiAxis].uMC_Power.EnablePositive := g_b_AxisEnable[UsiAxis] ;
        ActionAxisBasicControl[UsiAxis].uMC_Power.EnableNegative := g_b_AxisEnable[UsiAxis] ;       
    END_FOR;
ELSE
    FOR UsiAxis := 1 TO 7 BY 1 DO 
        ActionAxisBasicControl[UsiAxis].uMC_Power.Enable         := FALSE ;
        ActionAxisBasicControl[UsiAxis].uMC_Power.EnablePositive := FALSE ;
        ActionAxisBasicControl[UsiAxis].uMC_Power.EnableNegative := FALSE ;     
    END_FOR;    
END_IF;

//停止
IF ( g_x_前急停=FALSE ) OR ( g_x_面板急停 = FALSE ) OR ( g_x_后急停 = FALSE ) THEN
    ActionAxisBasicControl[1].uMC_Stop.Execute := TRUE ;
    ActionAxisBasicControl[2].uMC_Stop.Execute := TRUE ;
    ActionAxisBasicControl[3].uMC_Stop.Execute := TRUE ;
    ActionAxisBasicControl[4].uMC_Stop.Execute := TRUE ;
    ActionAxisBasicControl[5].uMC_Stop.Execute := TRUE ;
    ActionAxisBasicControl[6].uMC_Stop.Execute := TRUE ;
    ActionAxisBasicControl[7].uMC_Stop.Execute := TRUE ;
ELSIF ActionAxisBasicControl[1].uMC_Stop.Done OR ActionAxisBasicControl[1].uMC_Stop.CommandAborted OR g_b_OneKeyReset THEN
    ActionAxisBasicControl[1].uMC_Stop.Execute := FALSE ;
ELSIF ActionAxisBasicControl[2].uMC_Stop.Done OR ActionAxisBasicControl[2].uMC_Stop.CommandAborted OR g_b_OneKeyReset THEN  
    ActionAxisBasicControl[2].uMC_Stop.Execute := FALSE ;
ELSIF ActionAxisBasicControl[3].uMC_Stop.Done OR ActionAxisBasicControl[3].uMC_Stop.CommandAborted OR g_b_OneKeyReset THEN
    ActionAxisBasicControl[3].uMC_Stop.Execute := FALSE ;
ELSIF ActionAxisBasicControl[4].uMC_Stop.Done OR ActionAxisBasicControl[4].uMC_Stop.CommandAborted OR g_b_OneKeyReset THEN
    ActionAxisBasicControl[4].uMC_Stop.Execute := FALSE ;
ELSIF ActionAxisBasicControl[5].uMC_Stop.Done OR ActionAxisBasicControl[5].uMC_Stop.CommandAborted OR g_b_OneKeyReset THEN
    ActionAxisBasicControl[5].uMC_Stop.Execute := FALSE ;
ELSIF ActionAxisBasicControl[6].uMC_Stop.Done OR ActionAxisBasicControl[6].uMC_Stop.CommandAborted OR g_b_OneKeyReset THEN
    ActionAxisBasicControl[6].uMC_Stop.Execute := FALSE ;
ELSIF ActionAxisBasicControl[7].uMC_Stop.Done OR ActionAxisBasicControl[7].uMC_Stop.CommandAborted OR g_b_OneKeyReset THEN
    ActionAxisBasicControl[7].uMC_Stop.Execute := FALSE ;   
END_IF;

//故障复位
IF g_b_FaultSingle AND g_b_OneKeyReset THEN
    g_Udi_FaultWord[1] := 0 ;
    g_Udi_FaultWord[2] := 0 ;
    g_Udi_FaultWord[3] := 0 ;
    g_Udi_FaultWord[4] := 0 ;
    ActionAxisBasicControl[1].uMC_Reset.Execute := TRUE ;
    ActionAxisBasicControl[2].uMC_Reset.Execute := TRUE ;
    ActionAxisBasicControl[3].uMC_Reset.Execute := TRUE ;
    ActionAxisBasicControl[4].uMC_Reset.Execute := TRUE ;
    ActionAxisBasicControl[5].uMC_Reset.Execute := TRUE ;
    ActionAxisBasicControl[6].uMC_Reset.Execute := TRUE ;
    ActionAxisBasicControl[7].uMC_Reset.Execute := TRUE ;
ELSIF ActionAxisBasicControl[1].uMC_Reset.Done THEN 
    ActionAxisBasicControl[1].uMC_Reset.Execute := FALSE ;
ELSIF ActionAxisBasicControl[2].uMC_Reset.Done THEN 
    ActionAxisBasicControl[2].uMC_Reset.Execute := FALSE ;  
ELSIF ActionAxisBasicControl[3].uMC_Reset.Done THEN 
    ActionAxisBasicControl[3].uMC_Reset.Execute := FALSE ;  
ELSIF ActionAxisBasicControl[4].uMC_Reset.Done THEN 
    ActionAxisBasicControl[4].uMC_Reset.Execute := FALSE ;  
ELSIF ActionAxisBasicControl[5].uMC_Reset.Done THEN 
    ActionAxisBasicControl[5].uMC_Reset.Execute := FALSE ;  
ELSIF ActionAxisBasicControl[6].uMC_Reset.Done THEN 
    ActionAxisBasicControl[6].uMC_Reset.Execute := FALSE ;  
ELSIF ActionAxisBasicControl[7].uMC_Reset.Done THEN 
    ActionAxisBasicControl[7].uMC_Reset.Execute := FALSE ;
ELSIF ActionAxisBasicControl[1].uMC_ReadStatus.Standstill AND
    ActionAxisBasicControl[2].uMC_ReadStatus.Standstill AND
    ActionAxisBasicControl[3].uMC_ReadStatus.Standstill AND
    ActionAxisBasicControl[4].uMC_ReadStatus.Standstill AND
    ActionAxisBasicControl[5].uMC_ReadStatus.Standstill AND
    ActionAxisBasicControl[6].uMC_ReadStatus.Standstill AND
    ActionAxisBasicControl[7].uMC_ReadStatus.Standstill THEN
    g_b_FaultSingle := FALSE ;
    g_b_OneKeyReset := FALSE ;
END_IF;

//Axis1 Infeed
IF g_b_ManualMode AND g_b_AxisJogF1 THEN
    ActionAxisBasicControl[1].uDMC_Jog.JogBackward      := FALSE ;  
    ActionAxisBasicControl[1].uDMC_Jog.JogForward       := TRUE ;
ELSIF g_b_ManualMode AND g_b_AxisJogB1 THEN
    ActionAxisBasicControl[1].uDMC_Jog.JogForward       := FALSE ;  
    ActionAxisBasicControl[1].uDMC_Jog.JogBackward      := TRUE ;
ELSIF g_b_ManualMode AND EDGEPOS(g_b_AxisSP1) AND (ActionAxisBasicControl[1].uMC_MoveRelative.Done = FALSE) THEN
    ActionAxisBasicControl[1].uMC_MoveRelative.Distance := REAL_TO_LREAL(In:= g_r_AxisRelPos[1]);
    //ActionAxisBasicControl[1].uMC_MoveRelative.Velocity := REAL_TO_LREAL(In:= g_r_AxisMotorSpeed[1]/(g_r_InputRotation[1]/g_r_OutputRotation[1])*(g_r_UnitsPerRotation[1]*3.141592)/60 );
    ActionAxisBasicControl[1].uMC_MoveRelative.Execute  := TRUE ;
ELSIF g_b_ManualMode AND g_b_AxisSP1 AND EDGEPOS(ActionAxisBasicControl[1].uMC_MoveRelative.Done)THEN
    ActionAxisBasicControl[1].uMC_MoveRelative.Execute  := FALSE;
    g_b_AxisSP1                                         := FALSE; 
ELSIF g_b_ManualMode AND g_b_OneKeyHome AND EDGEPOS(g_b_Config) THEN
    g_b_AxisGoHomeEnd[1]                                := FALSE;
    ActionAxisBasicControl[1].uMC_Home.Execute          := ActionAxisBasicControl[1].uMC_Power.Status ;
ELSIF g_b_ManualMode AND g_b_OneKeyHome AND EDGEPOS(ActionAxisBasicControl[1].uMC_Home.Done) THEN
    g_b_AxisGoHomeEnd[1]                                := TRUE;
    ActionAxisBasicControl[1].uMC_Home.Execute          := FALSE ;
ELSE
    ActionAxisBasicControl[1].uDMC_Jog.JogForward       := FALSE ;
    ActionAxisBasicControl[1].uDMC_Jog.JogBackward      := FALSE ;
    ActionAxisBasicControl[1].uMC_MoveRelative.Execute  := FALSE ;
END_IF;

//Axis2 Strech
IF g_b_ManualMode AND g_b_AxisJogF2 THEN                                                                //点进
    ActionAxisBasicControl[2].uDMC_Jog.JogBackward      := FALSE ;  
    ActionAxisBasicControl[2].uDMC_Jog.JogForward       := TRUE ;
ELSIF g_b_ManualMode AND g_b_AxisJogB2 THEN                                                             //点进
    ActionAxisBasicControl[2].uDMC_Jog.JogForward       := FALSE ;  
    ActionAxisBasicControl[2].uDMC_Jog.JogBackward      := TRUE ;           
ELSIF g_b_ManualMode AND g_b_OneKeyHome AND EDGEPOS(g_b_Config) THEN                                    //回零   
    g_b_AxisGoHomeEnd[2]                                := FALSE;
    ActionAxisBasicControl[2].uMC_Home.Execute          := ActionAxisBasicControl[2].uMC_Power.Status ;
ELSIF g_b_ManualMode AND g_b_OneKeyHome AND ActionAxisBasicControl[2].uMC_Home.Done THEN
    ActionAxisBasicControl[2].uMC_MoveAbsolute.Position  := REAL_TO_LREAL(In:= g_r_AxisBackPos[2]);
    ActionAxisBasicControl[2].uMC_MoveAbsolute.Direction := mcPositiveDirection ;
    ActionAxisBasicControl[2].uMC_MoveAbsolute.Execute   := TRUE ;
    IF EDGEPOS(ActionAxisBasicControl[2].uMC_MoveAbsolute.Done) THEN
        g_b_AxisGoHomeEnd[2]                                := TRUE;
        ActionAxisBasicControl[2].uMC_Home.Execute          := FALSE ;
        ActionAxisBasicControl[2].uMC_MoveAbsolute.Execute  := FALSE ;      
    END_IF;
ELSIF g_b_ManualMode AND g_b_AxisGoHomeEnd[2] AND ( g_b_AxisSN2 = FALSE ) AND EDGEPOS(g_b_AxisSP2) THEN //单步到位
    ActionAxisBasicControl[2].uMC_MoveAbsolute.Position  := REAL_TO_LREAL(In:= g_r_AxisAbsPos[2]);
    ActionAxisBasicControl[2].uMC_MoveAbsolute.Direction := mcPositiveDirection ;
    ActionAxisBasicControl[2].uMC_MoveAbsolute.Execute   := TRUE ;
ELSIF g_b_ManualMode AND g_b_AxisGoHomeEnd[2] AND ( g_b_AxisSP2 = FALSE ) AND EDGEPOS(g_b_AxisSN2) THEN //单步回位
    ActionAxisBasicControl[2].uMC_MoveAbsolute.Position  := REAL_TO_LREAL(In:= g_r_AxisBackPos[2]);
    ActionAxisBasicControl[2].uMC_MoveAbsolute.Direction := mcNegativeDirection ;
    ActionAxisBasicControl[2].uMC_MoveAbsolute.Execute   := TRUE ;
ELSIF g_b_ManualMode AND g_b_AxisGoHomeEnd[2] AND g_b_OneKeyChangeMold AND EDGEPOS(g_b_Config) THEN     //单步回位
    g_b_ChangeMoldDone[2]                                := FALSE;
    ActionAxisBasicControl[2].uMC_MoveAbsolute.Position  := REAL_TO_LREAL(In:= g_r_AxisChangeMoldPos[2]);
    ActionAxisBasicControl[2].uMC_MoveAbsolute.Direction := mcShortestWay ;
    ActionAxisBasicControl[2].uMC_MoveAbsolute.Execute   := TRUE ;
ELSIF g_b_ManualMode AND g_b_AxisGoHomeEnd[2] AND ( g_b_AxisSP2 OR g_b_AxisSN2 ) AND EDGEPOS(ActionAxisBasicControl[2].uMC_MoveAbsolute.Done) THEN
    ActionAxisBasicControl[2].uMC_MoveAbsolute.Execute  := FALSE;
    g_b_AxisSP2                                         := FALSE;
    g_b_AxisSN2                                         := FALSE; 
ELSIF g_b_ManualMode AND g_b_AxisGoHomeEnd[2] AND g_b_OneKeyChangeMold AND EDGEPOS(ActionAxisBasicControl[2].uMC_MoveAbsolute.Done) THEN
    g_b_ChangeMoldDone[2]                               := TRUE;
    ActionAxisBasicControl[2].uMC_MoveAbsolute.Execute  := FALSE;
ELSE
    ActionAxisBasicControl[2].uDMC_Jog.JogForward       := FALSE ;
    ActionAxisBasicControl[2].uDMC_Jog.JogBackward      := FALSE ;
    ActionAxisBasicControl[2].uMC_MoveAbsolute.Execute  := FALSE ;
END_IF;

//Axis3 FormerUp
IF g_b_ManualMode AND g_b_AxisJogF3 THEN                                                                //点进
    ActionAxisBasicControl[3].uDMC_Jog.JogBackward      := FALSE ;  
    ActionAxisBasicControl[3].uDMC_Jog.JogForward       := TRUE ;
ELSIF g_b_ManualMode AND g_b_AxisJogB3 THEN                                                             //点进
    ActionAxisBasicControl[3].uDMC_Jog.JogForward       := FALSE ;  
    ActionAxisBasicControl[3].uDMC_Jog.JogBackward      := TRUE ;           
ELSIF g_b_ManualMode AND g_b_OneKeyHome AND EDGEPOS(g_b_Config) THEN                                    //回零   
    g_b_AxisGoHomeEnd[3]                                := FALSE;
    ActionAxisBasicControl[3].uMC_Home.Execute          := ActionAxisBasicControl[3].uMC_Power.Status ;
ELSIF g_b_ManualMode AND g_b_OneKeyHome AND ActionAxisBasicControl[3].uMC_Home.Done THEN
    ActionAxisBasicControl[3].uMC_MoveAbsolute.Position  := REAL_TO_LREAL(In:= g_r_AxisBackPos[3]);
    ActionAxisBasicControl[3].uMC_MoveAbsolute.Direction := mcPositiveDirection ;
    ActionAxisBasicControl[3].uMC_MoveAbsolute.Execute   := TRUE ;
    IF EDGEPOS(ActionAxisBasicControl[3].uMC_MoveAbsolute.Done) THEN
        g_b_AxisGoHomeEnd[3]                                := TRUE;
        ActionAxisBasicControl[3].uMC_Home.Execute          := FALSE ;
        ActionAxisBasicControl[3].uMC_MoveAbsolute.Execute  := FALSE ;      
    END_IF;
ELSIF g_b_ManualMode AND g_b_AxisGoHomeEnd[3] AND ( g_b_AxisSN3 = FALSE ) AND EDGEPOS(g_b_AxisSP3) THEN //单步到位
    ActionAxisBasicControl[3].uMC_MoveAbsolute.Position  := REAL_TO_LREAL(In:= g_r_AxisAbsPos[3]);
    ActionAxisBasicControl[3].uMC_MoveAbsolute.Direction := mcPositiveDirection ;
    ActionAxisBasicControl[3].uMC_MoveAbsolute.Execute   := TRUE ;
ELSIF g_b_ManualMode AND g_b_AxisGoHomeEnd[3] AND ( g_b_AxisSP3 = FALSE ) AND EDGEPOS(g_b_AxisSN3) THEN //单步回位
    ActionAxisBasicControl[3].uMC_MoveAbsolute.Position  := REAL_TO_LREAL(In:= g_r_AxisBackPos[3]);
    ActionAxisBasicControl[3].uMC_MoveAbsolute.Direction := mcNegativeDirection ;
    ActionAxisBasicControl[3].uMC_MoveAbsolute.Execute   := TRUE ;
ELSIF g_b_ManualMode AND g_b_AxisGoHomeEnd[3] AND g_b_OneKeyChangeMold AND EDGEPOS(g_b_Config) THEN     //单步回位
    g_b_ChangeMoldDone[3]                                := FALSE;
    ActionAxisBasicControl[3].uMC_MoveAbsolute.Position  := REAL_TO_LREAL(In:= g_r_AxisChangeMoldPos[3]);
    ActionAxisBasicControl[3].uMC_MoveAbsolute.Direction := mcShortestWay ;
    ActionAxisBasicControl[3].uMC_MoveAbsolute.Execute   := TRUE ;
ELSIF g_b_ManualMode AND g_b_AxisGoHomeEnd[3] AND ( g_b_AxisSP3 OR g_b_AxisSN3 ) AND EDGEPOS(ActionAxisBasicControl[3].uMC_MoveAbsolute.Done) THEN
    ActionAxisBasicControl[3].uMC_MoveAbsolute.Execute  := FALSE;
    g_b_AxisSP3                                         := FALSE;
    g_b_AxisSN3                                         := FALSE; 
ELSIF g_b_ManualMode AND g_b_AxisGoHomeEnd[3] AND g_b_OneKeyChangeMold AND EDGEPOS(ActionAxisBasicControl[3].uMC_MoveAbsolute.Done) THEN
    g_b_ChangeMoldDone[3]                               := TRUE;
    ActionAxisBasicControl[3].uMC_MoveAbsolute.Execute  := FALSE;
ELSE
    ActionAxisBasicControl[3].uDMC_Jog.JogForward       := FALSE ;
    ActionAxisBasicControl[3].uDMC_Jog.JogBackward      := FALSE ;
    ActionAxisBasicControl[3].uMC_MoveAbsolute.Execute  := FALSE ;
END_IF;

//Axis4 FormerDown
IF g_b_ManualMode AND g_b_AxisJogF4 THEN                                                                //点进
    ActionAxisBasicControl[4].uDMC_Jog.JogBackward      := FALSE ;  
    ActionAxisBasicControl[4].uDMC_Jog.JogForward       := TRUE ;
ELSIF g_b_ManualMode AND g_b_AxisJogB4 THEN                                                             //点进
    ActionAxisBasicControl[4].uDMC_Jog.JogForward       := FALSE ;  
    ActionAxisBasicControl[4].uDMC_Jog.JogBackward      := TRUE ;           
ELSIF g_b_ManualMode AND g_b_OneKeyHome AND EDGEPOS(g_b_Config) THEN                                    //回零   
    g_b_AxisGoHomeEnd[4]                                := FALSE;
    ActionAxisBasicControl[4].uMC_Home.Execute          := ActionAxisBasicControl[4].uMC_Power.Status ;
ELSIF g_b_ManualMode AND g_b_OneKeyHome AND ActionAxisBasicControl[4].uMC_Home.Done THEN
    ActionAxisBasicControl[4].uMC_MoveAbsolute.Position  := REAL_TO_LREAL(In:= g_r_AxisBackPos[4]);
    ActionAxisBasicControl[4].uMC_MoveAbsolute.Direction := mcPositiveDirection ;
    ActionAxisBasicControl[4].uMC_MoveAbsolute.Execute   := TRUE ;
    IF EDGEPOS(ActionAxisBasicControl[4].uMC_MoveAbsolute.Done) THEN
        g_b_AxisGoHomeEnd[4]                                := TRUE;
        ActionAxisBasicControl[4].uMC_Home.Execute          := FALSE ;
        ActionAxisBasicControl[4].uMC_MoveAbsolute.Execute  := FALSE ;      
    END_IF;
ELSIF g_b_ManualMode AND g_b_AxisGoHomeEnd[4] AND ( g_b_AxisSN4 = FALSE ) AND EDGEPOS(g_b_AxisSP4) THEN //单步到位
    ActionAxisBasicControl[4].uMC_MoveAbsolute.Position  := REAL_TO_LREAL(In:= g_r_AxisAbsPos[4]);
    ActionAxisBasicControl[4].uMC_MoveAbsolute.Direction := mcPositiveDirection ;
    ActionAxisBasicControl[4].uMC_MoveAbsolute.Execute   := TRUE ;
ELSIF g_b_ManualMode AND g_b_AxisGoHomeEnd[4] AND ( g_b_AxisSP4 = FALSE ) AND EDGEPOS(g_b_AxisSN4) THEN //单步回位
    ActionAxisBasicControl[4].uMC_MoveAbsolute.Position  := REAL_TO_LREAL(In:= g_r_AxisBackPos[3]);
    ActionAxisBasicControl[4].uMC_MoveAbsolute.Direction := mcNegativeDirection ;
    ActionAxisBasicControl[4].uMC_MoveAbsolute.Execute   := TRUE ;
ELSIF g_b_ManualMode AND g_b_AxisGoHomeEnd[4] AND g_b_OneKeyChangeMold AND EDGEPOS(g_b_Config) THEN     //单步回位
    g_b_ChangeMoldDone[4]                                := FALSE;
    ActionAxisBasicControl[4].uMC_MoveAbsolute.Position  := REAL_TO_LREAL(In:= g_r_AxisChangeMoldPos[4]);
    ActionAxisBasicControl[4].uMC_MoveAbsolute.Direction := mcShortestWay ;
    ActionAxisBasicControl[4].uMC_MoveAbsolute.Execute   := TRUE ;
ELSIF g_b_ManualMode AND g_b_AxisGoHomeEnd[4] AND ( g_b_AxisSP4 OR g_b_AxisSN4 ) AND EDGEPOS(ActionAxisBasicControl[4].uMC_MoveAbsolute.Done) THEN
    ActionAxisBasicControl[4].uMC_MoveAbsolute.Execute  := FALSE;
    g_b_AxisSP4                                         := FALSE;
    g_b_AxisSN4                                         := FALSE; 
ELSIF g_b_ManualMode AND g_b_AxisGoHomeEnd[4] AND g_b_OneKeyChangeMold AND EDGEPOS(ActionAxisBasicControl[4].uMC_MoveAbsolute.Done) THEN
    g_b_ChangeMoldDone[4]                               := TRUE;
    ActionAxisBasicControl[4].uMC_MoveAbsolute.Execute  := FALSE;
ELSE
    ActionAxisBasicControl[4].uDMC_Jog.JogForward       := FALSE ;
    ActionAxisBasicControl[4].uDMC_Jog.JogBackward      := FALSE ;
    ActionAxisBasicControl[4].uMC_MoveAbsolute.Execute  := FALSE ;
END_IF;

//Axis5 CutUp
IF g_b_ManualMode AND g_b_AxisJogF5 THEN                                                                //点进
    ActionAxisBasicControl[5].uDMC_Jog.JogBackward      := FALSE ;  
    ActionAxisBasicControl[5].uDMC_Jog.JogForward       := TRUE ;
ELSIF g_b_ManualMode AND g_b_AxisJogB5 THEN                                                             //点进
    ActionAxisBasicControl[5].uDMC_Jog.JogForward       := FALSE ;  
    ActionAxisBasicControl[5].uDMC_Jog.JogBackward      := TRUE ;           
ELSIF g_b_ManualMode AND g_b_OneKeyHome AND EDGEPOS(g_b_Config) THEN                                    //回零   
    g_b_AxisGoHomeEnd[5]                                := FALSE;
    ActionAxisBasicControl[5].uMC_Home.Execute          := ActionAxisBasicControl[5].uMC_Power.Status ;
ELSIF g_b_ManualMode AND g_b_OneKeyHome AND ActionAxisBasicControl[5].uMC_Home.Done THEN
    ActionAxisBasicControl[5].uMC_MoveAbsolute.Position  := REAL_TO_LREAL(In:= g_r_AxisBackPos[5]);
    ActionAxisBasicControl[5].uMC_MoveAbsolute.Direction := mcPositiveDirection ;
    ActionAxisBasicControl[5].uMC_MoveAbsolute.Execute   := TRUE ;
    IF EDGEPOS(ActionAxisBasicControl[5].uMC_MoveAbsolute.Done) THEN
        g_b_AxisGoHomeEnd[5]                                := TRUE;
        ActionAxisBasicControl[5].uMC_Home.Execute          := FALSE ;
        ActionAxisBasicControl[5].uMC_MoveAbsolute.Execute  := FALSE ;      
    END_IF;
ELSIF g_b_ManualMode AND g_b_AxisGoHomeEnd[5] AND ( g_b_AxisSN5 = FALSE ) AND EDGEPOS(g_b_AxisSP5) THEN //单步到位
    ActionAxisBasicControl[5].uMC_MoveAbsolute.Position  := REAL_TO_LREAL(In:= g_r_AxisAbsPos[5]);
    ActionAxisBasicControl[5].uMC_MoveAbsolute.Direction := mcPositiveDirection ;
    ActionAxisBasicControl[5].uMC_MoveAbsolute.Execute   := TRUE ;
ELSIF g_b_ManualMode AND g_b_AxisGoHomeEnd[5] AND ( g_b_AxisSP5 = FALSE ) AND EDGEPOS(g_b_AxisSN5) THEN //单步回位
    ActionAxisBasicControl[5].uMC_MoveAbsolute.Position  := REAL_TO_LREAL(In:= g_r_AxisBackPos[5]);
    ActionAxisBasicControl[5].uMC_MoveAbsolute.Direction := mcNegativeDirection ;
    ActionAxisBasicControl[5].uMC_MoveAbsolute.Execute   := TRUE ;
ELSIF g_b_ManualMode AND g_b_AxisGoHomeEnd[5] AND g_b_OneKeyChangeMold AND EDGEPOS(g_b_Config) THEN     //单步回位
    g_b_ChangeMoldDone[5]                                := FALSE;
    ActionAxisBasicControl[5].uMC_MoveAbsolute.Position  := REAL_TO_LREAL(In:= g_r_AxisChangeMoldPos[5]);
    ActionAxisBasicControl[5].uMC_MoveAbsolute.Direction := mcShortestWay ;
    ActionAxisBasicControl[5].uMC_MoveAbsolute.Execute   := TRUE ;
ELSIF g_b_ManualMode AND g_b_AxisGoHomeEnd[5] AND ( g_b_AxisSP5 OR g_b_AxisSN5 ) AND EDGEPOS(ActionAxisBasicControl[5].uMC_MoveAbsolute.Done) THEN
    ActionAxisBasicControl[5].uMC_MoveAbsolute.Execute  := FALSE;
    g_b_AxisSP5                                         := FALSE;
    g_b_AxisSN5                                         := FALSE; 
ELSIF g_b_ManualMode AND g_b_AxisGoHomeEnd[5] AND g_b_OneKeyChangeMold AND EDGEPOS(ActionAxisBasicControl[5].uMC_MoveAbsolute.Done) THEN
    g_b_ChangeMoldDone[5]                               := TRUE;
    ActionAxisBasicControl[5].uMC_MoveAbsolute.Execute  := FALSE;
ELSE
    ActionAxisBasicControl[5].uDMC_Jog.JogForward       := FALSE ;
    ActionAxisBasicControl[5].uDMC_Jog.JogBackward      := FALSE ;
    ActionAxisBasicControl[5].uMC_MoveAbsolute.Execute  := FALSE ;
END_IF;

//Axis6 CutDown
IF g_b_ManualMode AND g_b_AxisJogF6 THEN                                                                //点进
    ActionAxisBasicControl[6].uDMC_Jog.JogBackward      := FALSE ;  
    ActionAxisBasicControl[6].uDMC_Jog.JogForward       := TRUE ;
ELSIF g_b_ManualMode AND g_b_AxisJogB6 THEN                                                             //点进
    ActionAxisBasicControl[6].uDMC_Jog.JogForward       := FALSE ;  
    ActionAxisBasicControl[6].uDMC_Jog.JogBackward      := TRUE ;           
ELSIF g_b_ManualMode AND g_b_OneKeyHome AND EDGEPOS(g_b_Config) THEN                                    //回零   
    g_b_AxisGoHomeEnd[6]                                := FALSE;
    ActionAxisBasicControl[6].uMC_Home.Execute          := ActionAxisBasicControl[6].uMC_Power.Status ;
ELSIF g_b_ManualMode AND g_b_OneKeyHome AND ActionAxisBasicControl[6].uMC_Home.Done THEN
    ActionAxisBasicControl[6].uMC_MoveAbsolute.Position  := REAL_TO_LREAL(In:= g_r_AxisBackPos[6]);
    ActionAxisBasicControl[6].uMC_MoveAbsolute.Direction := mcPositiveDirection ;
    ActionAxisBasicControl[6].uMC_MoveAbsolute.Execute   := TRUE ;
    IF EDGEPOS(ActionAxisBasicControl[6].uMC_MoveAbsolute.Done) THEN
        g_b_AxisGoHomeEnd[6]                                := TRUE;
        ActionAxisBasicControl[6].uMC_Home.Execute          := FALSE ;
        ActionAxisBasicControl[6].uMC_MoveAbsolute.Execute  := FALSE ;      
    END_IF;
ELSIF g_b_ManualMode AND g_b_AxisGoHomeEnd[6] AND ( g_b_AxisSN6 = FALSE ) AND EDGEPOS(g_b_AxisSP6) THEN //单步到位
    ActionAxisBasicControl[6].uMC_MoveAbsolute.Position  := REAL_TO_LREAL(In:= g_r_AxisAbsPos[6]);
    ActionAxisBasicControl[6].uMC_MoveAbsolute.Direction := mcPositiveDirection ;
    ActionAxisBasicControl[6].uMC_MoveAbsolute.Execute   := TRUE ;
ELSIF g_b_ManualMode AND g_b_AxisGoHomeEnd[6] AND ( g_b_AxisSP6 = FALSE ) AND EDGEPOS(g_b_AxisSN6) THEN //单步回位
    ActionAxisBasicControl[6].uMC_MoveAbsolute.Position  := REAL_TO_LREAL(In:= g_r_AxisBackPos[6]);
    ActionAxisBasicControl[6].uMC_MoveAbsolute.Direction := mcNegativeDirection ;
    ActionAxisBasicControl[6].uMC_MoveAbsolute.Execute   := TRUE ;
ELSIF g_b_ManualMode AND g_b_AxisGoHomeEnd[6] AND g_b_OneKeyChangeMold AND EDGEPOS(g_b_Config) THEN     //单步回位
    g_b_ChangeMoldDone[6]                                := FALSE;
    ActionAxisBasicControl[6].uMC_MoveAbsolute.Position  := REAL_TO_LREAL(In:= g_r_AxisChangeMoldPos[6]);
    ActionAxisBasicControl[6].uMC_MoveAbsolute.Direction := mcShortestWay ;
    ActionAxisBasicControl[6].uMC_MoveAbsolute.Execute   := TRUE ;
ELSIF g_b_ManualMode AND g_b_AxisGoHomeEnd[6] AND ( g_b_AxisSP6 OR g_b_AxisSN6 ) AND EDGEPOS(ActionAxisBasicControl[6].uMC_MoveAbsolute.Done) THEN
    ActionAxisBasicControl[6].uMC_MoveAbsolute.Execute  := FALSE;
    g_b_AxisSP6                                         := FALSE;
    g_b_AxisSN6                                         := FALSE; 
ELSIF g_b_ManualMode AND g_b_AxisGoHomeEnd[6] AND g_b_OneKeyChangeMold AND EDGEPOS(ActionAxisBasicControl[6].uMC_MoveAbsolute.Done) THEN
    g_b_ChangeMoldDone[6]                               := TRUE;
    ActionAxisBasicControl[6].uMC_MoveAbsolute.Execute  := FALSE;
ELSE
    ActionAxisBasicControl[6].uDMC_Jog.JogForward       := FALSE ;
    ActionAxisBasicControl[6].uDMC_Jog.JogBackward      := FALSE ;
    ActionAxisBasicControl[6].uMC_MoveAbsolute.Execute  := FALSE ;
END_IF;

//Axis7 Stacker
IF g_b_ManualMode AND g_b_AxisJogF7 THEN                                                                //点进
    ActionAxisBasicControl[7].uDMC_Jog.JogBackward      := FALSE ;  
    ActionAxisBasicControl[7].uDMC_Jog.JogForward       := TRUE ;
ELSIF g_b_ManualMode AND g_b_AxisJogB7 THEN                                                             //点进
    ActionAxisBasicControl[7].uDMC_Jog.JogForward       := FALSE ;  
    ActionAxisBasicControl[7].uDMC_Jog.JogBackward      := TRUE ;           
ELSIF g_b_ManualMode AND g_b_OneKeyHome AND EDGEPOS(g_b_Config) THEN                                    //回零   
    g_b_AxisGoHomeEnd[7]                                := FALSE;
    ActionAxisBasicControl[7].uMC_Home.Execute          := ActionAxisBasicControl[6].uMC_Power.Status ;
ELSIF g_b_ManualMode AND g_b_OneKeyHome AND ActionAxisBasicControl[7].uMC_Home.Done THEN
    ActionAxisBasicControl[7].uMC_MoveAbsolute.Position  := REAL_TO_LREAL(In:= g_r_AxisBackPos[6]);
    ActionAxisBasicControl[7].uMC_MoveAbsolute.Direction := mcPositiveDirection ;
    ActionAxisBasicControl[7].uMC_MoveAbsolute.Execute   := TRUE ;
    IF EDGEPOS(ActionAxisBasicControl[7].uMC_MoveAbsolute.Done) THEN
        g_b_AxisGoHomeEnd[7]                                := TRUE;
        ActionAxisBasicControl[7].uMC_Home.Execute          := FALSE ;
        ActionAxisBasicControl[7].uMC_MoveAbsolute.Execute  := FALSE ;      
    END_IF;
ELSIF g_b_ManualMode AND g_b_AxisGoHomeEnd[7] AND ( g_b_AxisSN7 = FALSE ) AND EDGEPOS(g_b_AxisSP7) THEN //单步到位
    ActionAxisBasicControl[7].uMC_MoveAbsolute.Position  := REAL_TO_LREAL(In:= g_r_AxisAbsPos[7]);
    ActionAxisBasicControl[7].uMC_MoveAbsolute.Direction := mcPositiveDirection ;
    ActionAxisBasicControl[7].uMC_MoveAbsolute.Execute   := TRUE ;
ELSIF g_b_ManualMode AND g_b_AxisGoHomeEnd[7] AND ( g_b_AxisSP7 = FALSE ) AND EDGEPOS(g_b_AxisSN7) THEN //单步回位
    ActionAxisBasicControl[7].uMC_MoveAbsolute.Position  := REAL_TO_LREAL(In:= g_r_AxisBackPos[7]);
    ActionAxisBasicControl[7].uMC_MoveAbsolute.Direction := mcNegativeDirection ;
    ActionAxisBasicControl[7].uMC_MoveAbsolute.Execute   := TRUE ;
ELSIF g_b_ManualMode AND g_b_AxisGoHomeEnd[7] AND g_b_OneKeyChangeMold AND EDGEPOS(g_b_Config) THEN     //单步回位
    g_b_ChangeMoldDone[7]                                := FALSE;
    ActionAxisBasicControl[7].uMC_MoveAbsolute.Position  := REAL_TO_LREAL(In:= g_r_AxisChangeMoldPos[7]);
    ActionAxisBasicControl[7].uMC_MoveAbsolute.Direction := mcShortestWay ;
    ActionAxisBasicControl[7].uMC_MoveAbsolute.Execute   := TRUE ;
ELSIF g_b_ManualMode AND g_b_AxisGoHomeEnd[7] AND ( g_b_AxisSP7 OR g_b_AxisSN7 ) AND EDGEPOS(ActionAxisBasicControl[7].uMC_MoveAbsolute.Done) THEN
    ActionAxisBasicControl[7].uMC_MoveAbsolute.Execute  := FALSE;
    g_b_AxisSP7                                         := FALSE;
    g_b_AxisSN7                                         := FALSE; 
ELSIF g_b_ManualMode AND g_b_AxisGoHomeEnd[7] AND g_b_OneKeyChangeMold AND EDGEPOS(ActionAxisBasicControl[7].uMC_MoveAbsolute.Done) THEN
    g_b_ChangeMoldDone[7]                               := TRUE;
    ActionAxisBasicControl[7].uMC_MoveAbsolute.Execute  := FALSE;
ELSE
    ActionAxisBasicControl[7].uDMC_Jog.JogForward       := FALSE ;
    ActionAxisBasicControl[7].uDMC_Jog.JogBackward      := FALSE ;
    ActionAxisBasicControl[7].uMC_MoveAbsolute.Execute  := FALSE ;
END_IF;

ActionAxisBasicControl[1]();
ActionAxisBasicControl[2]();
ActionAxisBasicControl[3]();
ActionAxisBasicControl[4]();
ActionAxisBasicControl[5]();
ActionAxisBasicControl[6]();
ActionAxisBasicControl[7]();

通过上面的程序就完成了轴的寸动、回原点、单步定位等控制。

Pro_Encoder

变量声明:

范围 名称 地址 数据类型 初始值 注释
VAR uDMC_WriteParameter_Motion ARRAY[1..5] OF DMC_WriteParameter_Motion

程序内容:

//当前链轨宽度
g_r_EncoderActPos[1] := UDINT_TO_REAL(In:= REAL_TO_UDINT(In:= (UDINT_TO_REAL(In:= Axis[3].ActCust / 4 ) / g_r_EncoderPPU[1] * g_r_EncoderGuide[1] * 2 * 10) ) / 10 );
g_r_EncoderActPos[2] := UDINT_TO_REAL(In:= REAL_TO_UDINT(In:= (UDINT_TO_REAL(In:= Axis[4].ActCust / 4 ) / g_r_EncoderPPU[2] * g_r_EncoderGuide[2] * 2) * 10 ) / 10 );
g_r_EncoderActPos[3] := UDINT_TO_REAL(In:= REAL_TO_UDINT(In:= (UDINT_TO_REAL(In:= Axis[5].ActCust / 4 ) / g_r_EncoderPPU[3] * g_r_EncoderGuide[3] * 2) * 10 ) / 10 );
g_r_EncoderActPos[4] := UDINT_TO_REAL(In:= REAL_TO_UDINT(In:= (UDINT_TO_REAL(In:= Axis[6].ActCust / 4 ) / g_r_EncoderPPU[4] * g_r_EncoderGuide[4] * 2) * 10 ) / 10 );

IF EDGEPOS(g_b_SystemNetOK) THEN
    uDMC_WriteParameter_Motion[1].Data    := g_Udi_ServoCN5Encoder[1] ;
    uDMC_WriteParameter_Motion[1].Execute := TRUE ;
    uDMC_WriteParameter_Motion[2].Data    := g_Udi_ServoCN5Encoder[2] ;
    uDMC_WriteParameter_Motion[2].Execute := TRUE ;
    uDMC_WriteParameter_Motion[3].Data    := g_Udi_ServoCN5Encoder[3] ;
    uDMC_WriteParameter_Motion[3].Execute := TRUE ;
    uDMC_WriteParameter_Motion[4].Data    := g_Udi_ServoCN5Encoder[4] ;
    uDMC_WriteParameter_Motion[4].Execute := TRUE ;
ELSIF EDGEPOS(g_b_ChainSetPos1) THEN
    uDMC_WriteParameter_Motion[1].Data    := REAL_TO_UDINT(In:= g_r_EncoderSetPos[1] * 4 / 2 / g_r_EncoderGuide[1] * g_r_EncoderPPU[1] );
    uDMC_WriteParameter_Motion[1].Execute := TRUE ; 
ELSIF uDMC_WriteParameter_Motion[1].Done then
    uDMC_WriteParameter_Motion[1].Execute := FALSE ;
    g_b_ChainSetPos1                      := FALSE ;
ELSIF EDGEPOS(g_b_ChainSetPos2) THEN
    uDMC_WriteParameter_Motion[2].Data    := REAL_TO_UDINT(In:= g_r_EncoderSetPos[2] * 4 / 2 / g_r_EncoderGuide[2] * g_r_EncoderPPU[2] );
    uDMC_WriteParameter_Motion[2].Execute := TRUE ;  
ELSIF uDMC_WriteParameter_Motion[2].Done then
    uDMC_WriteParameter_Motion[2].Execute := FALSE ;
    g_b_ChainSetPos2                      := FALSE ;
ELSIF EDGEPOS(g_b_ChainSetPos3) THEN
    uDMC_WriteParameter_Motion[3].Data    := REAL_TO_UDINT(In:= g_r_EncoderSetPos[3] * 4 / 2 / g_r_EncoderGuide[3] * g_r_EncoderPPU[3] );
    uDMC_WriteParameter_Motion[3].Execute := TRUE ; 
ELSIF uDMC_WriteParameter_Motion[3].Done then
    uDMC_WriteParameter_Motion[3].Execute := FALSE ;
    g_b_ChainSetPos3                      := FALSE ;
ELSIF EDGEPOS(g_b_ChainSetPos4) THEN
    uDMC_WriteParameter_Motion[4].Data    := REAL_TO_UDINT(In:= g_r_EncoderSetPos[4] * 4 / 2 / g_r_EncoderGuide[4] * g_r_EncoderPPU[4] );
    uDMC_WriteParameter_Motion[4].Execute := TRUE ; 
ELSIF uDMC_WriteParameter_Motion[4].Done then
    uDMC_WriteParameter_Motion[4].Execute := FALSE ;
    g_b_ChainSetPos3                      := FALSE ;
END_IF;
//写链宽位置
uDMC_WriteParameter_Motion[1](EN:= TRUE,Axis:= 3,Index:= 16#2511,SubIndex:= 16#0,DataType:= 4);
uDMC_WriteParameter_Motion[2](EN:= TRUE,Axis:= 4,Index:= 16#2511,SubIndex:= 16#0,DataType:= 4);
uDMC_WriteParameter_Motion[3](EN:= TRUE,Axis:= 5,Index:= 16#2511,SubIndex:= 16#0,DataType:= 4);
uDMC_WriteParameter_Motion[4](EN:= TRUE,Axis:= 6,Index:= 16#2511,SubIndex:= 16#0,DataType:= 4);

Pro_Logic

Log:
2019.10.01 发布本文
深夜突然想到,应该要引入g_i_AxisCtrlWord[i] 这种数据类型。
0=停止
1 = 点动正转
2 = 点动反转
3 = 回零
4 = 单步正
5 = 单步反
这样子就能减少触摸屏bool的变量交互。程序上也可以用Case 语法进行编写。

你可能感兴趣的:(多工位正负压热成型机)