MC_TouchProbe

MC_TouchProbe 1:

This function block controls the recording of an axis position at a trigger event.
One of WindowFirstPosition or WindowLastPosition can be left as 'Ignore' if no corresponding limit is desired.

Syntax

Definition:

FUNCTION_BLOCK MC_TouchProbe
VAR_INPUT
    Axis                 : Type_PtpTouchProbe;
END_VAR
VAR_IN_OUT
    TriggerInput         : Reference To TRIGGER_REF;
END_VAR
VAR_INPUT
    Execute              : BOOL;
    Options              : TouchProbeOptions;
END_VAR
VAR_OUTPUT
    Done                 : BOOL;
    Busy                 : BOOL;
    CommandAborted       : BOOL;
    Error                : BOOL;
    ErrorId              : UDINT;
    RecordedPosition     : LREAL;
    RecordedDcTimestamp  : LINT;
    RecordedEventCounter : UDINT;
    InWindow             : BOOL;
END_VAR

MC_TouchProbe 2: Inputs

Name

Type

Description

Axis

Type_PtpTouchProbe

Reference to the axis

Execute

BOOL

Trigger the command with rising edge.

Options

TouchProbeOptions

Options for the touch probe

MC_TouchProbe 3: In/Outputs

Name

Type

Description

TriggerInput

Reference To TRIGGER_REF

Reference to the trigger signal source like DriveTouchProbeRef or BinaryTouchProbeRef

MC_TouchProbe 4: Outputs

Name

Type

Description

Done

BOOL

Touch probe process succeeded

Busy

BOOL

Function block is not finished and new output values are to be expected.

CommandAborted

BOOL

Command is aborted by another command (MC_AbortTrigger).

Error

BOOL

Error occurred within function block.

ErrorId

UDINT

Error identifier

RecordedPosition

LREAL

Position where trigger event occurred ([PosUnit]).

RecordedDcTimestamp

LINT

DcTime at trigger event

RecordedEventCounter

UDINT

Number of recorded trigger events

InWindow

BOOL

TRUE if the recorded position is within the configured window.

Possible error codes

For this function block, the following values, among others, are possible for the ErrorId output:

Error(Hex)

Error(Dec)

Error type

Description

0x8145

33093

Function Block

Mapping of cyclic interface between NC and PLC is missing (e.g., AXIS_REF, AXES_GROUP_REF, ...). A reference used by the function block (e.g., to an axis, group, mover or other motion object) is not linked to the corresponding NC object, or its cyclic mapping is incomplete.

0x8199

33177

Function Block

Command not allowed. The command is not allowed in the current configuration.

0x81bb

33211

Function Block

Invalid trigger reference for touch probe. The specified touch probe reference is invalid. This can occur if an invalid probe ID, edge type, or trigger mode was specified.

An overview of all NC error codes can be found here:

Version information

  • TwinCAT Standard >= v3.1.4026.23.1
  • TF5500 MC3 Base >= v4.0.6