MC_Home

MC_Home 1:

Calibration of the axis (referencing) is carried out with the function block MC_Home.

Referencing mode is set in the TwinCAT System Manager via the Incremental encoder tab. Depending on the connected encoder system, different procedures are possible (see also Reference mode for inkremental encoder)

Inputs


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

MC_BufferMode MC_HomingMode

Execute

The command is executed with a rising edge at Execute input.

Position

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.
Notice Since the reference position is generally set during the motion, the axis will not stop exactly at this position. The standstill position deviates by the braking distance of the axis, nevertheless the calibration is exact.

HomingMode

HomingMode determines in which way the calibration is carried out.

  • MC_DefaultHoming
    Initiates standard homing.
  • MC_Direct
    Sets the axis position directly to Position without executing a movement.
  • 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.

BufferMode

Currently not implemented - BufferMode is analyzed if the axis is already executing another command. The running command can be aborted, or the new command becomes active after the running command. The BufferMode also determines the transition condition from the current to the next command.

Options

The data structure Options includes additional, rarely required parameters. The input can normally remain open.

Options.

ClearPositionLag

ClearPositionLag is only effective in MC_Direct mode. ClearPositionLagcan optionally be used to set the set and actual positions to the same value. In this case the following error is cleared.

bCalibrationCam

bCalibrationCam reflects the signal of a referencing cam that may enter the controller via a digital input.

General rules for MC function blocks

Outputs


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

Done

The Done output becomes TRUE, if the axis was calibrated and has come to a standstill.

Busy

The Busy output becomes TRUE when the command is started with Execute and remains TRUE as long as the movement command is processed. If Busy becomes FALSE again, the function block is ready for a new job. At the same time one of the outputs, Done, CommandAborted or Error, is set.

Active

Currently not implemented - Active indicates that the command is running. If the command was queued, it becomes active once a running command is completed.

CommandAborted

Becomes TRUE, if the command could not be fully executed.

Error

Becomes TRUE if an error occurs.

ErrorID

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

General rules for MC function blocks

Inputs/outputs


VAR_IN_OUT
Axis : AXIS_REF;
END_VAR

AXIS_REF

Axis

Axis data structure

The axis data structure of type AXIS_REF addresses an axis uniquely within the system. Among other parameters it contains the current axis status, including position, velocity or error status.

Note

The referencing process has several phases. The referencing state (calibration state) is signaled in the cyclic interface of the axis (Axis.NcToPlc.HomingState). The following diagram illustrates the individual process phases after starting of the MC_Home block.

If an axis is to be referenced without reference cam, i.e. only based on the sync pulse of the sensor, the reference cam can be simulated via the PLC program. The bCalibrationCam signal is initially activated and then cancelled, if Axis.NcToPlc.HomingState is equal or greater 4.

MC_Home 2: