MC_Home

MC_Home 1:

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

The reference mode is set in the TwinCAT SystemManager in the encoder Incremental dialog (also see Reference mode for incremental encoder).

VAR_INPUT

VAR_INPUT
    Execute         : BOOL;
    Position        : LREAL;
    bCalibrationCam : BOOL;
END_VAR

Execute : The command is executed with rising edge.

Position : Position when the reference cam is reached. The constant DEFAULT_HOME_POSITION can be used to make use of the Calibration Value which is defined in the TwinCAT SystemManger.

bCalibrationCam : Reference cam.

VAR_OUTPUT

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

Done : Becomes TRUE once referencing is complete.

CommandAborted : Becomes TRUE, if the command could not be fully executed. The reason may be an error, a stop or a superimposed travel command.

Error: Becomes TRUE, as soon as an error occurs.

ErrorID : Supplies the error number when the Error output is set.

VAR_IN_OUT

VAR_IN_OUT
    Axis    : NCTOPLC_AXLESTRUCT;
    AxisOut : PLCTONC_AXLESTRUCT;
END_VAR

Axis : Axis structure.

AxisOut : Axis structure from PLC to NC.

Requirements

Development environment

Target system type

PLC libraries to be linked

TwinCAT v2.8

PC (i386)

TcMC.Lib

 

Note

The referencing process has several phases. The referencing state (calibration state) is signalled in the cyclic interface of the axis (Axis.nCalibrationState). 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.nCalibrationState is equal or greater 4.

 

MC_Home 2: