MC_TouchProbe

MC_TouchProbe 1:

The function block MC_TouchProbe records an axis position at the time of a digital signal (touch probe function). The position is usually not recorded directly in the PLC environment, but via an external hardware latch and is therefore highly accurate and independent of the cycle time. The function block controls this mechanism and determines the externally recorded position.

MC_TouchProbe 2:

The function block was extended, compared to TwinCAT 2. It has the same functionality as the existing function block MC_TouchProbe_V2.

Requirements

The prerequisite for the position detection is suitable encoder hardware that is able to latch the recorded position. Support is offered for:

The digital trigger signal is wired into this hardware and, independently of the PLC cycle, triggers the recording of the current axis position.

These end devices have to be configured to some extent so that a position detection is possible. Beckhoff EtherCAT drives can be configured with the System Manager. Note that the probe unit has to be configured with the "Extended NC Probe Unit" interface.

MC_TouchProbe 3:

After a touch probe cycle has been initiated by a rising edge on the "Execute" input, this is only terminated if the outputs "Done", "Error" or" CommandAborted" become TRUE. If the process is to be interrupted at an intermediate point in time, the function block MC_AbortTrigger with the same TriggerInput data structure must be called up. Otherwise no new cycle can be initiated.

Signal curve

MC_TouchProbe 4:

MC_TouchProbe 5: Inputs

VAR_INPUT
    Execute       : BOOL;
    WindowOnly    : BOOL;
    FirstPosition : LREAL;
    LastPosition  : LREAL;
END_VAR

Name

Type

Description

Execute

BOOL

The command is executed with a rising edge.

WindowOnly

BOOL

If WindowOnly = TRUE, only one position within the window between "FirstPosition" and "LastPosition" is recorded. Positions outside the window are rejected and the external position latch is automatically newly activated. Only if the recorded position lies inside the window, "Done" becomes TRUE. The recording window can be interpreted in terms of absolute or modulo values. For this purpose, the "ModuloPositions" flag must be set accordingly in the TriggerInput data structure. In the case of absolute value positions there is exactly one window. With modulo positions, the window is repeated within the modulo cycle defined in the axis parameters (e.g. 0 to 360 degrees).

FirstPosition

LREAL

Initial position of the recording window, if "WindowOnly" is TRUE. This position can be interpreted as an absolute or modulo value. For this purpose, the "ModuloPositions" flag must be set accordingly in the TriggerInput data structure.

LastPosition

LREAL

End position of the recording window, if "WindowOnly" is TRUE. This position can be interpreted as an absolute or modulo value. For this purpose, the "ModuloPositions" flag must be set accordingly in the TriggerInput data structure.

MC_TouchProbe 6:

Requirements

Development environment

Target system type

PLC libraries to include

TwinCAT v3.0.0

PC or CX (x86 or x64)

Tc2_MC2

MC_TouchProbe 7: Outputs

VAR_OUTPUT
    Done             : BOOL;
    Busy             : BOOL;
    CommandAborted   : BOOL;
    Error            : BOOL;
    ErrorId          : UDINT;
    RecordedPosition : LREAL;
    RecordedData     : MC_TouchProbeRecordedData; 
END_VAR 

Name

Type

Description

Done

BOOL

TRUE if an axis position was successfully detected. The position is sent to the output "RecordedPosition".

Busy

BOOL

TRUE as soon as the function block is active. FALSE if it is in the default state.

CommandAborted

BOOL

TRUE if the process is interrupted by an external event, e.g. by the call up of MC_AbortTrigger.

Error

BOOL

TRUE, if an error occurs.

ErrorID

UDINT

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

RecordedPosition

LREAL

Axis position recorded at the point in time of the trigger signal

RecordedData

MC_TouchProbeRecordedData

Data structure with complementary information relating to the logged axis position at the time of the trigger signal

MC_TouchProbe 8: Inputs/outputs

VAR_IN_OUT
    Axis         : AXIS_REF;
    TriggerInput : TRIGGER_REF; 
END_VAR

Name

Type

Description

Axis

AXIS_REF

Axis data structure

TriggerInput

TRIGGER_REF

Data structure for describing the trigger source. This data structure must be parameterized before the function block is called for the first time.