ST_SetPositionOptions

This data type contains the optional settings for the function block MC_SetPosition.

TYPE ST_SetPositionOptions
STRUCT
    ClearPositionLag    : BOOL;
    SelectEncoderIndex  : BOOL;
    EncoderIndex        : UINT;
    ClearPositionOffset : BOOL;
END_STRUCT
END_TYPE

ClearPositionOffset – deleting the MC_SetPosition offset

The position offset totaled by the MC_SetPosition call can be deleted with this function block. To do this, the ClearPositionOffset switch is set in the options; the position transferred to the block is not relevant in this case.

ST_SetPositionOptions 1:

This option is available from TwinCAT 3.1.4024.51 and Tc2_MC2 3.3.56.

VAR
    mcSetPositionClear: MC_SetPosition;
END_VAR
mcSetPositionClear.Options.ClearPositionOffset := TRUE;
mcSetPositionClear (
    Axis:= Axis,
    Position:= , // not relevant
    Execute:= TRUE);

Homing the axis, e.g. with MC_Home, produces a newly referenced coordinate system for the axis and also deletes the offset.