MC_ReinitializeEncoder

MC_ReinitializeEncoder 1:

The MC_ReinitializeEncoder function block is used to reinitialize the position of an encoder, similar to how it is initialized when TwinCAT restarts.

MC_ReinitializeEncoder 2: Inputs

VAR_INPUT
    Execute           : BOOL;
    Options           : ST_ReinitializeEncoderOptions;
END_VAR

Name

Type

Description

Execute

BOOL

The command is executed with a rising edge.

Options

ST_ReinitializeEncoderOptions

Data structure containing additional, rarely used parameters. The input can normally remain open.

SelectEncoderIndex: can be set if an axis with several encoders is used and the position of a specific encoder is to be reinitialized (Options.EncoderIndex).

EncoderIndex: indicates the encoder (0…n) if “SelectEncoderIndex” is TRUE.

MC_ReinitializeEncoder 3: 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_ReinitializeEncoder 4: Outputs

VAR_OUTPUT
    Done              : BOOL;
    Busy              : BOOL;
    Error             : BOOL;
    ErrorID           : UDINT;
END_VAR

Name

Type

Description

Done

BOOL

TRUE if the command was executed without errors.

Busy

BOOL

TRUE as soon as the command is started with Execute and as long as the command is processed. If “Busy” is FALSE, the function block is ready for a new order.

Error

BOOL

TRUE if an error occurs.

ErrorID

UDINT

If the error output is set, this parameter provides the error number.

Requirements

Development environment

Target platform

PLC library to include

TwinCAT v3.1.4024.79

TwinCAT v3.1.4026

  • TF5000.NCPTP.XAE 1.0.11

PC or CX (x86)

Tc2_MC2 v3.3.75