查看: 755|回复: 1
收起左侧

[资料分享] 中型PLC

ZYBb 2023-1-8 18:43:55 | 显示全部楼层 |阅读模式
邀请回答

马上注册,享受更多特权

您需要 登录 才可以下载或查看,没有帐号?立即注册   

x

AM600

1.储存空间分配

区域 用途 大小 地址范围
I区(%I)128KB 用户使用区域 64kWords %IW0-%IW65535
Q区(%Q)128KB 用户使用 64kWords %QW0-%QW65535
M区 用户使用 240kWords %MW0-%MW245759
M区 SD元件 10000Words %MW245760-%MW255759
M区 SM元件 10000Bytes %MB511520-%MB521519
M区 保留 2768Bytes %MB521520-%MB524287

这其中有480KB用户可以直接使用。

2.变量数据类型

类型 关键字 范围 占用内存
布尔类型 BOOL TRUE,FALSE,1,0 8Bit
BIT类型 BIT TRUE,FALSE,0,1只能在结构体或者功能块中使用 1Bit
整数 BYTE 0-255 8Bit
WORD 0-65535 16Bit
DWORD 0-4294967295 32Bit
LWORD 0-2^e64 -1 64Bit
SINT -128-127 8Bit
USINT 0-255 8Bit
INT -32768-32767 16Bit
UINT 0-65535 16Bit
DINT -2147483648-2147483647 32Bit
类型 关键字 范围 占用内存
UDINT 0-4294967295 32Bit
LINT -2^e32-2^e32 -1 64Bit
ULINT 0-2^e64 -1 64Bit
浮点类型 REAL 1.401^e-45-3.203^e38 32Bit
LREAL 2.2250738585072014^e-308-1.7976931348623158^e+308 64Bit
字符串 STRING 只支持ACCII码字符(不支持中文字符)。默认长度80字符,超过最大长度会被去掉。可以声明字符最大长度,如str:STRING:=‘This is a String’;字符串函数最大支持255字符 ASCII形式存储字符串,用一个字节存储结束符
WSTRING 只支持UNICODE字符(支持中文字符)。默认最大初度80字符,超过最大长度会被去掉。可以声明字符最大长度,如wstr:WSTRING(35):="THIS IS A WString" UNICODE形式存储字符串,用一个字节存储结束符
时间 TIME 时间常量,日,时,分,秒,毫秒 32Bit,内部按Dword处理
TIME_OF_DAYE(TOD) 一天时间常量 32Bit,内部按Dword处理
DATE 日期常量,从1970年1月1日开始 32Bit,内部按Dword处理
DATE_AND_TIME(DT) 日期和时间常量,从1970年1月1日开始 32Bit,内部按Dword处理

定时器相关

脉冲产生

  • 定时器

    out       :=  TON1.Q;      //输出模式
    TON1(
    PT  :=  T#1S,        //定时器时间
    IN  :=  NOT TON2.Q,  //输入应该在的位置
    Q    => TON2.IN,  //输出给到TON2的输入
    );
    TON2(
    PT  :=  T#1S,
    );

    • [x] 理解
    1. 将两个定时器串联之后,利用两个定时器来互相控制

    2. 将一个定时器中的引脚取反,反向之后给到另外一个的输入,完成一个复位操作,将定时器复位,然后即可完成定时脉冲

    3. 具体的逻辑:

      ​        开始接通之后定时器延迟一定时间之后接通,这时候接通之后定时器二开始计时,等到定时器二接通之后复位之前的定时器,这时候重新开始。

    • [x] 掌握:

    • [x] TP完成:

    • [x] TOF完成:

    • [x] 反向脉冲:

  • 函数库

    BLINK
      (ENABLE   :=  , //使能状态
       TIMELOW  :=  , //0位时间
       TIMEHIGH :=  , //1位时间
       OUT       =>   //输出
       );

轴控指令

1. 自带库

1.1. 使能

MC_Power(
    Axis                    := , //对应轴
    Enable                  := , //是否激活功能块
    bRegulatorOn            := , //位TRUE激活功能块使能状态
    bDriveStart             := , //为TRUE关闭功能块的紧急停止
    Status                  => , //输出TRUE为轴使能完成
    bRegulatorRealState     => , //轴使能有效状态
    bDriveStartRealState    => , //在驱动器没有被快速停止时为TRUE
    Busy                    => , //在驱动器没有处理完成之前为TRUE
    Error                   => , //错误标识
    ErrorID                 => );//对应错误编号

1.2. 点动

MC_Jog(
    Axis                    := , //对应的轴
    JogForward              := , //注意F和B只能有一个为TRUE,两者同时为TRUE的时候就不会运动
    JogBackward             := , 
    Velocity                := , //点动速度
    Acceleration            := , //加速度
    Deceleration            := , //减速度
    Jerk                    := , 
    Busy                    => , 
    CommandAborted          => , //为TRUE在一个功能块被另外一个功能块中断的时候
    Error                   => , 
    ErrorId                 => );

1.3. 回零

/*************************************************
 *1.作用是回归零点
 *2.零点的返回需要有所搭配,对应接近开关
 *************************************************/
MC_Home(
    Axis            := , 
    Execute         := , 
    Position        := , //信号到达时候的绝对位置
    Done            => , 
    Busy            => , 
    CommandAborted  => , 
    Error           => , 
    ErrorID         => );

1.4. 复位

/*************************************************
 *1.复位内部错误
 *2.不能复位像掉线这样的错误
 *************************************************/
MC_Reset(
    Axis    := , 
    Execute := , 
    Done    => , 
    Busy    => , 
    Error   => , 
    ErrorID => );

结构体&枚举&数组

结构体

  • [x] 结构体定义
TYPE St_PointAxis :   //轴结构体参数
STRUCT
    /****************输入参数***********************
     *
     *
     *
     *********************************************/
    i_iGoabs_dir    : INT;                              //轴运动方向
    i_xReset        : BOOL;                             //轴复位
    i_xSerOn        : BOOL;                             //轴使能
    i_xStop         : BOOL;                             //轴停止
    i_xHalt         : BOOL;                             //轴暂停
    i_xHome         : BOOL;                             //轴回零
    i_xJogP         : BOOL;                             //轴正向点动
    i_xJogN         : BOOL;                             //轴反向点动
    i_xGoAbs        : BOOL;                             //轴绝对定位
    i_xGobRel       : BOOL;                             //轴相对定位
    i_xSetPos       : BOOL;                             //轴位置设定
    i_xGoVel        : BOOL;                             //轴速度运行
    i_xTorqueEnable : BOOL;                             //力矩控制使能
    i_xVirtual      : BOOL;                             //虚轴开关
    i_fAxisAcc      : LREAL := 1000;                    //加速度设定
    i_fAxisDec      : LREAL := 1000;                    //减速度设定
    i_fJogVel       : LREAL;                            //轴点动速度
    i_fHome_Pos     : LREAL;                            //轴回原偏置
    i_fGoAbs_Pos    : LREAL;                            //轴绝对定位位置
    i_fGoAbs_Vel    : LREAL;                            //轴绝对定位速度
    i_fGoRel_Pos    : LREAL;                            //轴相对定位位置
    i_fGoRel_Vel    : LREAL;                            //轴相对定位速度
    i_fGoVel_Vel    : LREAL;                            //轴速度模式速度
    i_fSetPos_Pos   : LREAL;                            //轴设定位置
    i_fSetTorque    : LREAL;                            //轴设定转矩
    /****************输出参数***********************
     *
     *
     *
     *********************************************/
    o_xFbErr        : BOOL;                             //轴控功能块报错
    o_xFbBusy       : BOOL;                             //轴控功能块运行中
    o_xFbDone       : BOOL;                             //轴控功能块完成
    o_iFbErrID      : UDINT;                            //轴控功能块报错ID
    o_xAxisStand    : BOOL;                             //轴故障
    o_xAxisRun      : BOOL;                             //轴等待
    o_iAxisState    : INT;                              //轴状态机
    o_xDriveRdy     : BOOL;                             //站等待
    o_xDriveEN      : BOOL;                             //站运行
    o_xDriveErr     : BOOL;                             //站报错
    o_xDriveAlarm   : BOOL;                             //站报警
    o_xPositiveLimit: BOOL;                             //轴正限位
    O_xNegativeLimit: BOOL;                             //轴负限位
    o_xHomeSwitch   : BOOL;                             //轴原点开关
    o_fActVel       : LREAL;                            //轴实际速度
    o_fActPos       : LREAL;                            //轴实际位置
    o_fActTor       : LREAL;                            //轴实际转矩
    o_xRestDone     : BOOL;                             //轴复位完成
    o_xResetErr     : BOOL;                             //轴复位失败
    /****************指针***********************
     *
     *
     *
     *******************************************/
    pAxisETC        : POINTER TO AXIS_REF_ETC_DS402_CS; //Ethercat轴结构体地址
    pServer         : POINTER TO ETCSlave;              //站地址
END_STRUCT
END_TYPE
  • [x] 结构体调用
VAR_IN_OUT
    stPointAxis       :  St_PointAxis;
END_VAR
  • [x] 结构体使用
stPointAxis.i_xReset := ;

枚举

  • [x] 枚举定义
TYPE Enum_StateMachine :
(
    未就绪      := 0,
    故障       := 1,
    初始化中    := 2,
    待机       := 3,
    手动       := 4,
    自动       := 5
);
END_TYPE
  • [ ] 枚举调用
  • [ ] 枚举使用

数组

凸轮函数使用

  • [x] FB变量
END_VAR
VAR_INPUT
    i_xMasterMode       : BOOL;                                 //凸轮的主轴模式,0相对模式,1绝对模式
    i_xSlaveMode        : BOOL;                                 //凸轮的从轴模式,0相对模式,1绝对模式
    i_xPeriodic         : BOOL;                                 //凸轮周期模式,0非周期,1周期
    i_pstCam            : POINTER TO SMC_CAMXYVA;               //凸轮点结构体
    i_iNElements        : INT;                                  //凸轮点数
    i_fXstart           : LREAL;                                //凸轮主轴的起始位置
    i_fXend             : LREAL;                                //凸轮主轴结束位置
    i_fMasterOffset     : LREAL := 0;                           //主轴的偏移
    i_fSlaveOffset      : LREAL := 0;                           //从轴的偏移
    i_fMasterScaling    : LREAL := 1;                           //主轴缩放比
    i_fSlaveScaling     : LREAL := 1;                           //从轴缩放比
    i_xExcute           : BOOL;                                 //触发信号
    i_xStop             : BOOL;                                 //停止信号
END_VAR
VAR_OUTPUT
    o_fMasterPos        : LREAL;                                //凸轮中主轴位置
    o_xEndProfile       : BOOL;                                 //凸轮周期结束信号
    o_xInSync           : BOOL;                                 //凸轮同步中信号
    o_xError            : BOOL;                                 //凸轮报错信号
    o_eErrorID          : SMC_ERROR;                            //错误信息
END_VAR
VAR
    MC_CAM_REF_0        : MC_CAM_REF;                           //
    MC_CamIn_0          : MC_CamIn;                             //
    MC_CamTableSelect_0 : MC_CamTableSelect;                    //
    MC_CamOUT_0         : MC_CamOut;                            //
    MC_Stop_0           : MC_Stop;                              //
    v_pstCamXYVAold     : ARRAY[0..1024] OF SMC_CAMXYVA;        //
    i                   : INT;                                  //循环使用
    v_xPointChange      : BOOL;                                 //凸轮点需要修改标志
    Rtring_PointChange  : R_TRIG;                               //凸轮点需要修改信号的上升沿
    Rtring_Excute       : R_TRIG;                               //触发信号上升沿
    Rtring_Stop         : R_TRIG;                               //停止信号上升沿
    v_xExcuCamtable     : BOOL;                                 //触发凸轮表信号
    v_fXStartOLD        : LREAL;                                //凸轮起始位置缓存
    v_fXEndOld          : LREAL;                                //凸轮结束位置缓存
    rise_error          : R_TRIG;                               
END_VAR
  • [x] FB功能块使用
Rtring_Excute(
    CLK             := i_xExcute,
    );
Rtring_PointChange(
    CLK             := v_xPointChange,
    );
Rtring_Stop(
    CLK             := i_xStop,
    );
MC_CamIn_0(
    Master          := master,
    Slave           := slaver,
    EndOfProfile    => o_xEndProfile,
    );
IF Rtring_Excute.Q THEN
    o_xError        := FALSE;
    o_eErrorID      := 0;
END_IF

FOR i := 0 TO i_iNElements BY 1 DO
    IF     NOT (v_pstCamXyVaold[i].dx = i_pstCamXYVA[i].dX) OR NOT (i_pstCamXYVA[i].dy = v_pstCamXYVAold[i].dY) 
        OR NOT (v_pstCamXYVAold[i].dv = i_pstCamXYVA[i].dV) OR NOT (i_pstCamXYVA[i].da = v_pstCamXYVAold[i].da)
        OR NOT (i_fXstart             = v_fXEndOld        ) OR NOT (i_fXend            = v_fXEndOld)            THEN
        v_xPointChange  := TRUE;
        EXIT;
    END_IF      
END_FOR

IF v_xExcCamtable THEN
    v_xExcCamtable  := FALSE;
END_IF

IF v_xPointChange AND (MC_CamIn_0.EndOfProfile OR Rtring_Excute.Q) AND NOT i_xStop AND NOT o_xError THEN
    FOR i := 1 TO i_iNElements BY 1 DO
        v_pstCamXYVAold[i]  := i_pstCamXYVA[i];
        v_xExcCamtable      := TRUE;
    END_FOR
    v_fXStartOLD            := i_fXstart;
    v_fXEndOld              := i_fXend;
    v_xPointChange          := FALSE;
END_IF

MC_CAM_REF_0(
    wCamStructID            := , 
    byType                  := 3, 
    byVarType               := , 
    xStart                  := v_fXStartOLD, 
    xEnd                    := v_fXEndOld, 
    nElements               := i_iNElements, 
    nTappets                := , 
    pce                     := ADR(v_pstCamXYVAold), 
    pt                      := , 
    dwTappetActiveBits      := , 
    strCAMName              := , 
    byInterpolationQuality  := , 
    byCompatibilityMode     := , 
    bChangedOnline          := , 
    xPartofLM               := );

MC_CamTableSelect_0(
    Master                  := master, 
    Slave                   := slaver, 
    CamTable                := MC_CAM_REF_0, 
    Execute                 := (v_xExcCamtable OR (Rtring_Excute.Q AND NOT o_xInSync)) AND NOT i_xStop, 
    Periodic                := i_xPeriodic, 
    MasterAbsolute          := i_xMasterMode, 
    SlaveAbsolute           := i_xSlaveMode, 
    Done                    => , 
    Busy                    => , 
    Error                   => , 
    ErrorID                 => , 
    CamTableID              => );
MC_CamIn_0(
    Master                  := master, 
    Slave                   := slaver, 
    Execute                 := MC_CamTableSelect_0.Done, 
    MasterOffset            := i_fMasterOffset, 
    SlaveOffset             := i_fSlaveOffset, 
    MasterScaling           := i_fMasterScaling, 
    SlaveScaling            := i_fSlaveScaling, 
    StartMode               := absolute, 
    CamTableID              := MC_CamTableSelect_0.CamTableID, 
    VelocityDiff            := , 
    Acceleration            := , 
    Deceleration            := , 
    Jerk                    := , 
    TappetHysteresis        := , 
    InSync                  => o_xInSync, 
    Busy                    => , 
    CommandAborted          => , 
    Error                   => , 
    ErrorID                 => , 
    EndOfProfile            => , 
    Tappets                 => );

MC_CamOUT_0(
    Slave                   := slaver, 
    Execute                 := MC_CamOUT_0.Done, 
    Done                    => , 
    Busy                    => , 
    Error                   => , 
    ErrorID                 => );

MC_Stop_0(
    Axis                    := slaver, 
    Execute                 := MC_CamOUT_0.Done, 
    Deceleration            := ABS(slaver.fSetVelocity * 100) + 1, 
    Jerk                    := , 
    Done                    => , 
    Busy                    => , 
    Error                   => , 
    ErrorID                 => );

rise_error(
    CLK                     := MC_CamTableSelect_0.Error OR MC_CamIn_0.Error OR
                               MC_CamOUT_0.Error         OR MC_Stop_0.Error,
            );
IF rise_error.Q THEN
    o_xError                := TRUE;
    o_eErrorID              := MAX(MC_CamTableSelect_0.ErrorID,MC_CamIn_0.ErrorID,MC_CamOUT_0.ErrorID,MC_Stop_0.ErrorID);
END_IF                 
o_fMasterPos                := MC_CamIn_0.xr;

电子齿轮

  • [x] FB参数
FUNCTION_BLOCK FB_AxisGear
VAR_IN_OUT
    master          : AXIS_REF_SM3; //主轴
    slaver          : AXIS_REF_SM3; //从轴
END_VAR
VAR_INPUT
    i_xGearIn       : BOOL;         //齿轮耦合
    i_xGearOut      : BOOL;         //齿轮脱离
    i_diNumerator   : DINT  := 1;   //齿轮分子
    i_udiDenominator: UDINT := 1;   //齿轮分母
END_VAR
VAR_OUTPUT
    o_xIsGearing    : BOOL;         //齿轮进行
    o_xGearDone     : BOOL;         //齿轮结束
    o_xGearErr      : BOOL;         //齿轮故障
END_VAR
VAR
    MC_GearIn_0     : MC_GearIn;
    MC_GearOut_0    : MC_GearOut;
    MC_Stop_0       : MC_Stop;
    lrAccDec        : LREAL;
END_VAR
  • [x] 调用
lrAccDec            := 4194300400 / slaver.fFactorVel;

(*----------------------------电子齿轮启动函数---------------------------------*
 *
 *
 *
 *++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*)
 MC_GearIn_0(
    Master              := master, 
    Slave               := slaver, 
    Execute             := i_xGearIn AND NOT i_xGearOut, 
    RatioNumerator      := i_diNumerator, 
    RatioDenominator    := i_udiDenominator, 
    Acceleration        := lrAccDec, 
    Deceleration        := lrAccDec, 
    Jerk                := , 
    InGear              => , 
    Busy                => o_xIsGearing, 
    CommandAborted      => , 
    Error               => , 
    ErrorID             => );

 (*----------------------------电子齿轮关闭函数---------------------------------*
 *
 *
 *
 *++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*)
 MC_GearOut_0(
    Slave               := slaver, 
    Execute             := i_xGearOut AND NOT i_xGearIn AND (o_xIsGearing OR MC_GearOut_0.Execute), 
    Done                => , 
    Busy                => , 
    Error               => , 
    ErrorID             => );
 MC_Stop_0(
    Axis                := Slaver, 
    Execute             := MC_GearOut_0.Done OR MC_GearOut_0.Error, 
    Deceleration        := lrAccDec, 
    Jerk                := , 
    Done                => o_xGearDone, 
    Busy                => , 
    Error               => , 
    ErrorID             => );

    o_xGearErr          := MC_GearIn_0.Error OR MC_GearIn_0.CommandAborted OR MC_Stop_0.Error;

轴控指令

  • [x] 轴控参数
FUNCTION_BLOCK FB_AxisControl
VAR_IN_OUT
    stPointAxis                 : St_PointAxis;
END_VAR
VAR_INPUT
    i_xManual                   : BOOL;
    i_xJogP                     : BOOL;
    i_xJogN                     : BOOL;

END_VAR
VAR_OUTPUT
END_VAR
VAR 
    v_xSerOff                   : BOOL; //使能关闭
    v_iAxisState                : INT;  //轴复位步序
    v_udiCount                  : UDINT;//计数

    (**************ETC功能块实例化*************)
    SMC3_ReinitDrive_ETC        : SMC3_ReinitDrive;
    SMC_SetControllerMode_ETC   : SMC_SetControllerMode;
    MC_SetPosition_ETC          : MC_SetPosition;
    MC_MoveAbsolute_ETC         : MC_MoveAbsolute;
    MC_MoveRelative_ETC         : MC_MoveRelative;
    MC_MoveAdditive_ETC         : MC_MoveAdditive;
    MC_MoveVelocity_ETC         : MC_MoveVelocity;
    SMC_SetTorque_ETC           : SMC_SetTorque;
    MC_Power_ETC                : MC_Power;
    MC_Reset_ETC                : MC_Reset;
    MC_Home_ETC                 : MC_Home;
    MC_Stop_ECT                 : MC_Stop;
    MC_Jog_ETC                  : MC_Jog;
    MC_Halt_ETC                 : MC_Halt;

    (**************ETC功能块实例化*************)
    MC_MoveAbsolute_CO          : MC_MoveABsolute_CO;
    MC_MoveRelative_Co          : MC_MoveRelative_CO;
    MC_MoveVelocity_CO          : MC_MoveVelocity_CO;
    MC_Power_CO                 : MC_Power_CO;
    MC_Reset_CO                 : MC_Reset_CO;
    MC_Stop_CO                  : MC_Stop_CO;
    MC_Jog_CO                   : MC_Jog_CO;
    MC_Halt_CO                  : MC_Halt_CO;

    (**************ETC功能块实例化*************)
    MC_Moveabsolute_P           : MC_MoveAbsolute_P;
    MC_MoveRelative_P           : MC_MoveRelative_P;
    MC_MoveVelocity_P           : MC_MoveVelocity_P;
    MC_Power_P                  : MC_Power_P;
    MC_Reset_P                  : MC_Reset_P;
    MC_Home_P                   : MC_Home_P;
    MC_Stop_P                   : MC_Stop_P;
    MC_Jog_P                    : MC_Jog_P;
    MC_Setposition_p            : MC_SetPosition_P;

    v_xJoging                   : BOOL;
    in                          : INT;  
END_VAR
  • [x] 轴控调用
stPointAxis.pAxisETC^.bVirtual  := stPointAxis.i_xVirtual;

(**************ETC功能块实例化*************)
MC_Power_ETC(
    Axis                        := stPointAxis.pAxisETC^, 
    Enable                      := TRUE, 
    bRegulatorOn                := stPointAxis.i_xSerOn AND (NOT v_xSerOff), 
    bDriveStart                 := stPointAxis.i_xSerOn, 
    Status                      => , 
    bRegulatorRealState         => , 
    bDriveStartRealState        => , 
    Busy                        => , 
    Error                       => , 
    ErrorID                     => );

MC_Stop_ECT(
    Axis                        := stPointAxis.pAxisETC^, 
    Execute                     := stPointAxis.i_xStop, 
    Deceleration                := stPointAxis.i_fAxisAcc, 
    Jerk                        := , 
    Done                        => , 
    Busy                        => , 
    Error                       => , 
    ErrorID                     => );

MC_Halt_ETC(
    Axis                        := stPointAxis.pAxisETC^, 
    Execute                     := stPointAxis.i_xHalt, 
    Deceleration                := stPointAxis.i_fAxisDec, 
    Jerk                        := , 
    Done                        => , 
    Busy                        => , 
    CommandAborted              => , 
    Error                       => , 
    ErrorID                     => );

MC_Home_ETC(
    Axis                        := stPointAxis.pAxisETC^, 
    Execute                     := stPointAxis.i_xHome, 
    Position                    := stPointAxis.i_fHome_Pos, 
    Done                        => , 
    Busy                        => , 
    CommandAborted              => , 
    Error                       => , 
    ErrorID                     => );

MC_SetPosition_ETC(
    Axis                        := stPointAxis.pAxisETC^, 
    Execute                     := stPointAxis.i_xSetPos, 
    Position                    := stPointAxis.i_fSetPos_Pos, 
    Mode                        := , 
    Done                        => , 
    Busy                        => , 
    Error                       => , 
    ErrorID                     => );    

MC_MoveAbsolute_ETC(
    Axis                        := stPointAxis.pAxisETC^, 
    Execute                     := stPointAxis.i_xGoAbs, 
    Position                    := stPointAxis.i_fGoAbs_Pos, 
    Velocity                    := stPointAxis.i_fGoAbs_Vel, 
    Acceleration                := stPointAxis.i_fAxisAcc, 
    Deceleration                := stPointAxis.i_fAxisDec, 
    Jerk                        := , 
    Direction                   := stPointAxis.i_iGoabs_dir, 
    Done                        => , 
    Busy                        => , 
    CommandAborted              => , 
    Error                       => , 
    ErrorID                     => );

MC_MoveRelative_ETC(
    Axis                        := stPointAxis.pAxisETC^, 
    Execute                     := stPointAxis.i_xGoREl, 
    Distance                    := stPointAxis.i_fGoRel_Pos, 
    Velocity                    := stPointAxis.i_fGoRel_Vel, 
    Acceleration                := stPointAxis.i_fAxisAcc, 
    Deceleration                := stPointAxis.i_fAxisDec, 
    Jerk                        := , 
    Done                        => , 
    Busy                        => , 
    CommandAborted              => , 
    Error                       => , 
    ErrorID                     => );
MC_MoveAdditive_ETC(
    Axis                        := stPointAxis.pAxisETC^, 
    Execute                     := , 
    Distance                    := , 
    Velocity                    := , 
    Acceleration                := stPointAxis.i_fAxisAcc, 
    Deceleration                := stPointAxis.i_fAxisDec, 
    Jerk                        := , 
    Done                        => , 
    Busy                        => , 
    CommandAborted              => , 
    Error                       => , 
    ErrorID                     => );

    MC_MoveVelocity_ETC.Direction := - 1;

IF stPointAxis.i_fGoVel_Vel >= 0 THEN
    MC_MoveVelocity_ETC.Direction :=   1;   
END_IF  

MC_MoveVelocity_ETC(
    Axis                        := stPointAxis.pAxisETC^, 
    Execute                     := FALSE, 
    Velocity                    := , 
    Acceleration                := , 
    Deceleration                := , 
    Jerk                        := , 
    Direction                   := , 
    InVelocity                  => , 
    Busy                        => , 
    CommandAborted              => , 
    Error                       => , 
    ErrorID                     => );    
MC_MoveVelocity_ETC(
    Axis                        := stPointAxis.pAxisETC^, 
    Execute                     := stPointAxis.i_xGoVel, 
    Velocity                    := stPointAxis.i_fGoVel_Vel, 
    Acceleration                := stPointAxis.i_fAxisAcc, 
    Deceleration                := stPointAxis.i_fAxisDec, 
    Jerk                        := , 
    Direction                   := , 
    InVelocity                  => , 
    Busy                        => , 
    CommandAborted              => , 
    Error                       => , 
    ErrorID                     => );        

MC_Jog_ETC(
    Axis                        := stPointAxis.pAxisETC^, 
    JogForward                  := stPointAxis.i_xJogP,
    JogBackward                 := stPointAxis.i_xJogN, 
    Velocity                    := stPointAxis.i_fJogVel, 
    Acceleration                := stPointAxis.i_fAxisAcc, 
    Deceleration                := stPointAxis.i_fAxisDec, 
    Jerk                        := , 
    Busy                        => , 
    CommandAborted              => , 
    Error                       => , 
    ErrorId                     => );

MC_Reset_ETC(
    Axis                        := stPointAxis.pAxisETC, 
    Execute                     := (stPointAxis.pAxisETC^.nAxisState = 1) AND (v_iAxisState =2), 
    Done                        => , 
    Busy                        => , 
    Error                       => , 
    ErrorID                     => );

SMC3_ReinitDrive_ETC(
    Axis                        := stPointAxis.pAxisETC^, 
    bExecute                    := (stPointAxis.pAxisETC^.nAxisState <> 1) AND v_iAxisState =3, 
    bVirtual                    := , 
    bDone                       => , 
    bBusy                       => , 
    bError                      => , 
    nErrorID                    => );

SMC_SetTorque_ETC(
    Axis                        := stPointAxis.pAxisETC^, 
    bEnable                     := stPointAxis.i_xTorqueEnable, 
    fTorque                     := stPointAxis.i_fSetTorque, 
    bBusy                       => , 
    bError                      => , 
    nErrorID                    => );

stPointAxis.o_xFbErr    := MC_Stop_ECT.Error            OR MC_Home_ETC.Error            OR MC_SetPosition_ETC.Error
                        OR MC_MoveAbsolute_ETC.Error    OR MC_MoveRelative_ETC.Error    OR MC_MoveAdditive_ETC.Error
                        OR MC_Jog_ETC.Error             OR MC_MoveVelocity_ETC.Error    OR MC_Power_ETC.Error
                        OR MC_Halt_ETC.Error            OR SMC_SetTorque_ETC.bError;

stPointAxis.o_xFbDone   := MC_Stop_ECT.Done             OR MC_SetPosition_ETC.Done      OR MC_Home_ETC.Done 
                        OR MC_MoveAbsolute_ETC.Done     OR MC_MoveRelative_ETC.Done     OR MC_MoveAdditive_ETC.Done
                        OR MC_Halt_ETC.Done;

stPointAxis.o_xFbBusy   := MC_Stop_ECT.Busy             OR MC_Home_ETC.Busy             OR MC_SetPosition_ETC.Busy
                        OR MC_MoveAbsolute_ETC.Busy     OR MC_MoveRelative_ETC.Busy     OR MC_MoveAdditive_ETC.Busy
                        OR MC_Jog_ETC.Busy              OR MC_MoveVelocity_ETC.Busy     OR MC_Halt_ETC.Busy;

stPointAxis.o_iFbErrID  := DWORD_TO_UDINT(stPointAxis.pAxisETC^.fbeFBError[0].wID);




上一篇:西门子1200 V90伺服 EPLan图纸讲解
下一篇:倍福NCI插补和坐标系变换技术V1.0.2

已有 0 人打赏作者

回复 邀请回答送花

使用道具 举报

我愿人长久 2023-1-9 09:40:07 | 显示全部楼层
不错的资料,能做成PDF文档就更好了
回复 送花

使用道具 举报

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

本版积分规则

有技术问题,就上汇川技术社区

INOVANCE汇川技术 公众号

扫码下载掌上汇川APP

全国服务热线:8:30-17:30

4000-300124

苏州地址:江苏省苏州市吴中区越溪友翔路16号

深圳地址:深圳市龙华新区观澜街道高新技术产业园汇川技术总部大厦

Copyright © 2003-2100 汇川技术 Powered by Discuz! X3.4 ( 苏ICP备12002088号 )
快速回复 返回列表 返回顶部