MC_Home
An axis reference run is carried out with the function block MC_Home.
The referencing mode is set in the TwinCAT System Manager with the encoder parameter "Reference Mode". Depending on the connected encoder system, different sequences are possible (see also Reference mode for incremental encoders in the TwinCAT 3 ADS Interface NC documentation).
Inputs
VAR_INPUT
Execute : BOOL;
Position : LREAL := DEFAULT_HOME_POSITION;
HomingMode : MC_HomingMode;
BufferMode : MC_BufferMode;
Options : ST_HomingOptions;
bCalibrationCam : BOOL;
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 | Determines how the calibration is performed.
| |
BufferMode | MC_BufferMode | Currently not implemented. |
Options | Data structure containing additional, rarely used parameters. The input can normally remain open.
| |
bCalibrationCam | BOOL | Reflects the signal of a referencing cam that can be applied to the controller via a digital input. |
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. |
See also: General rules for MC function blocks
Inputs/outputs
VAR_IN_OUT
Axis : AXIS_REF;
END_VAR
Name | Type | Description |
---|---|---|
Axis | AXIS_REF | Axis data structure of the type AXIS_REF, which uniquely addresses an axis in the system. Among other parameters it contains the current axis status, including position, velocity or error state. |
Referencing process
The referencing process has several phases. The calibration state is signaled in the cyclic interface of the axis (Axis.NcToPlc.HomingState). The following diagram shows the process flow after starting function block MC_Home with the individual phases.
If an axis is to be referenced without referencing cam, i.e. only based on the sync pulse of the encoder, the referencing cam can be simulated via the PLC program. The "bCalibrationCam" signal is initially activated and then canceled, if Axis.NcToPlc.HomingState is equal or greater 4.
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 as soon as an error occurs. |
ErrorID | UDINT | If the error output is set, this parameter supplies the error number. |
See also: General rules for MC function blocks
Requirements
Development environment | Target system type | PLC libraries to include |
---|---|---|
TwinCAT v3.0.0 | PC or CX (x86 or x64) | Tc2_MC2 |