MC_Home (Homing)

MC_Home (Homing) 1:

An axis reference run is carried out with the function block MC_Home.

Reference mode is set in the options with the parameter "ReferenceMode".

MC_Home (Homing) 2:

The parameters involved may have to be set in the drive parameters. For the servo terminal, the parameters can be found in the objects DMC Setting (0x8030) or DMC Features (0x8031).

MC_Home (Homing) 3: Inputs

VAR_INPUT
    Execute         : BOOL; 
    Position        : LREAL         := DEFAULT_HOME_POSITION;
    HomingMode      : MC_HomingMode;
    Options         : ST_HomingOptions;
END_VAR

Name

Type

Description

Execute

BOOL

The command is executed with a rising edge.

Position

LREAL

Absolute reference position to which the axis is set after homing. Alternatively, the constant DEFAULT_HOME_POSITION can be used here. In this case, the "Reference position for homing" specified in the TwinCAT System Manager is used.

HomingMode

MC_HomingMode

Determines how the calibration is performed. (Type: MC_HomingMode)

  • MC_DefaultHoming
    Initiates default homing.
  • MC_Direct
    Sets the axis position directly to Position without executing a movement.
  • MC_Block
    Performs homing to a mechanical end stop.
  • MC_ForceCalibration
    Enforces the "axis is calibrated" state. No movement takes place, and the position remains unchanged.
  • MC_ResetCalibration
    Resets the calibration state of the axis. No movement takes place, and the position remains unchanged.

Options

ST_HomingOptions

Data structure containing additional parameters.

  • SearchDirection:
    Direction in which the referencing cam is to be searched
  • SearchVelocity:
    Velocity at which the referencing cam is to be searched
  • SyncDirection:
    Direction in which the falling edge of the referencing cam is searched after the referencing cam has been detected
  • SyncVelocity:
    Velocity at which the falling edge of the referencing cam is searched for after the referencing cam has been detected
  • ReferenceMode:
    Referencing mode (currently only ENCODERREFERENCEMODE_CAMATDIGITALINPUT)
  • Acceleration:
    Acceleration for homing
  • Deceleration:
    Deceleration for homing

The signal of a referencing cam must be routed to a digital terminal input (HomingMode = MC_DefaultHoming).

MC_Home (Homing) 4:

Since the reference position is generally set during the motion, the axis will not stop exactly at this position. The standstill position differs by the braking distance of the axis, although the calibration is nevertheless exact.

MC_Home (Homing) 5: 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_Home (Homing) 6: Outputs

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

Name

Type

Description

Done

BOOL

TRUE when the axis has been calibrated and the movement is complete.

Busy

BOOL

TRUE as soon as the command is started with "Execute" and as long as the movement command is processed. If "Busy" is FALSE, the function block is ready for a new order. At the same time, one of the outputs "Done", "CommandAborted" or "Error" is set.

Active

BOOL

Currently not implemented - "Active" indicates that the command is running. If the command has been buffered, it may only become active after a running command has been terminated.

CommandAborted

BOOL

TRUE if the command could not be executed completely.

Error

BOOL

TRUE, if an error occurs.

ErrorID

UDINT

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

Note

The referencing process has several phases. The following diagram illustrates the sequence after starting function block MC_Home with the individual phases for the case HomingMode = MC_DefaultHoming.

MC_Home (Homing) 7:

Requirements

Development environment

PLC libraries to include

TwinCAT 3.1.4024.11

Tc3_DriveMotionControl