MC_BacklashCompensation

MC_BacklashCompensation 1:

The MC_BacklashCompensation function block is used together with the axis parameter Position Correction to compensate backlash. It is possible to compensate negative as well as positive backlash.

MC_BacklashCompensation 2:

Instructions for use and necessary settings in TwinCAT:

  • The functionality described here works with the parameter Position Correction. This parameter must be activated in TwinCAT XAE or via ADS (see also TwinCAT 3 NC PTP Axes). The Backlash Compensation function offered in the XAE is only still present for compatibility reasons. Do not use it on new projects.
  • If the user also wants to use the function Position Correction in parallel to the function block MC_BacklashCompensation (whose implementation is based on the function Position Correction) for other purposes, then this "double use" of the parameter can be solved by a workaround in the PLC by feeding in the sum of both requirements using the function block MC_PositionCorrectionLimiter.

MC_BacklashCompensation 3: Inputs

VAR_INPUT
    Enable                           : BOOL;   
    Backlash                         : LREAL;
    CompensationInPositiveDirection  : BOOL;
    Ramp                             : LREAL;
    DisableMode                      : E_DisableMode;
    Options                          : ST_BacklashCompensationOptions;
END_VAR

Name

Type

Description

Enable

BOOL

The command is executed as long as Enable is active. Backlash compensation is hereby enabled.

Backlash

LREAL

Compensation value with sign [mm]. If the default value is used, the internal NC backlash value is read via ADS and used in this function block.

CompensationInPositiveDirection

BOOL

Compensation takes place in the selected working direction. FALSE (default): Backlash compensation must be executed when moving in negative direction. TRUE: Backlash compensation must be executed when moving in positive direction.

Ramp

LREAL

Velocity limit for entered backlash compensation (constant velocity and linear position as subprofiles for backlash compensation [mm/s]).

DisableMode

E_DisableMode

Disable mode: (0)=HOLD, (1)=RESET

Options

ST_BacklashCompensationOptions

Optional parameters (not implemented)

MC_BacklashCompensation 4: Inputs/outputs

VAR_IN_OUT
    Axis : AXIS_REF;
END_VAR

Name

Type

Description

Axis

AXIS_REF

Axis data structure that unambiguously addresses an axis in the system. Among other parameters it contains the current axis status, including position, velocity or error state.

MC_BacklashCompensation 5: Outputs

VAR_OUTPUT    
    Enabled                      : BOOL; 
    Busy                         : BOOL;
    Error                        : BOOL;
    ErrorId                      : UDINT;
    CurrentBacklash              : LREAL;
    Limiting                     : BOOL;
END_VAR

Name

Type

Description

Enabled

BOOL

This output becomes TRUE, if the backlash compensation has been enabled without error.

Busy

BOOL

This output becomes TRUE when the command is started with Enable and remains so as long as the function block executes the command.

Error

BOOL

This output becomes TRUE if an error has occurred during command execution.

ErrorId

UDINT

Contains the command-specific error code of the last executed command. Details of the error code can be found in the ADS error documentation or in the NC error documentation (error codes 0x4nnn and 0x8nnn).

CurrentBacklash

LREAL

Current compensation value [mm].

Limiting

BOOL

This output becomes TRUE if the function block currently limits the backlash compensation.

TYPE E_DisableMode:

(
    DisableModeHold         :=0, (* hold on the last output value (default) *)
    DisableModeReset        :=1 (* reset the output value to zero (jump to zero) *)
(*DisableModeRamp           :=2 *) (* ramp down the output to zero (NOT NEEDED YET) *)
);
END_TYPE

Requirements

Development environment

Target platform

PLC libraries to include

TwinCAT V3.0.0

PC or CX (x86 or x64)

Tc2_MC2