Data type TRIGGER_REF

TYPE TRIGGER_REF :
STRUCT
EncoderID       : UDINT;              (* 1..255 *)
TouchProbe      : E_TouchProbe;       (* probe unit definition *)
SignalSource    : E_SignalSource;     (* optional physical signal source used by the probe unit
                                            - available from TwinCAT 2.11 Build 2022 with MC_TouchProbe_V2 *)
Edge            : E_SignalEdge;       (* rising or falling signal edge *)
Mode            : E_TouchProbeMode;   (* single shot or continuous monitoring
                                            - available from TwinCAT 2.11 Build 2022 with MC_TouchProbe_V2 *)
PlcEvent        : BOOL;               (* PLC trigger signal input when TouchProbe signal source is set to 'PlcEvent' *)
ModuloPositions : BOOL;               (* interpretation of FirstPosition, LastPosition and RecordedPosition as modulo positions when TRUE *)
END_STRUCT
END_TYPE

EncoderID: The ID of an encoder is indicated in the TwinCAT System Manager.

TouchProbe : Defines the latch unit (probe unit) within the encoder hardware used.


TYPE E_TouchProbe :
(
TouchProbe1 := 1,    (* 1st hardware probe unit with Sercos, CanOpen, KL5xxx and others *)
TouchProbe2,         (* 2nd probe unit - available from MC_TouchProbe_V2_00 *)
TouchProbe3,         (* currently not available *)
TouchProbe4,         (* currently not available *)
PlcEvent := 10       (* simple PLC signal TRUE/FALSE *)
);
END_TYPE

SignalSource: Optionally defines the signal source, if it can be selected via the controller. In many cases the signal source is permanently configured in the drive and should then be set to the default value SignalSource_Default. (setting possibility only available from MC_TouchProbe_V2)


TYPE E_SignalSource :
(
SignalSource_Default,           (* undefined or externally configured *)
SignalSource_Input1,            (* digital drive input 1 *)
SignalSource_Input2,            (* digital drive input 2 *)
SignalSource_Input3,            (* digital drive input 3 *)
SignalSource_Input4,            (* digital drive input 4 *)
SignalSource_ZeroPulse := 128,  (* encoder zero pulse *)
SignalSource_DriveDefined       (* defined by drive parameters - e. g. CAN object 0x60D0 *)
);
END_TYPE

Edge : Defines whether the rising or falling edge of the trigger signal is evaluated.


TYPE E_SignalEdge :
(
RisingEdge,
FallingEdge
);
END_TYPE

Mode: Specifies the operating mode of the latch unit. In single mode only the first edge is sampled. In continuous mode each PLC cycle edge is signaled. (Mode only available with MC_TouchProbe_V2)


TYPE E_TouchProbeMode :
(
TOUCHPROBEMODE_SINGLE_COMPATIBILITYMODE,   (* for TwinCAT 2.10 and 2.11 before Build 2022 - for use with MC_TouchProbe as well *)
TOUCHPROBEMODE_SINGLE,                     (* multi probe interface - from 2.11 Build 2022 *)
TOUCHPROBEMODE_CONTINOUS                   (* multi probe interface - from 2.11 Build 2022 *)
);
END_TYPE

PlcEvent : If the signal source TouchProbe is set to the type PlcEvent, a rising edge on these variables triggers the recording of the current axis position. The PlcEvent is not a true latch function, but is cycle-time dependent.

ModuloPositions: If the variable ModuloPositions is FALSE, the axis position is interpreted in an absolute linear range from -∞ to +∞. The positions FirstPosition, LastPosition und RecordedPosition of the MC_TouchProbe or MC_TouchProbe_V2 function block are then also absolute.
If ModuloPositions is TRUE, all positions are interpreted as modulo values in the modulo range of the axis used (e.g. 0..359.9999). At the same time this means that a defined trigger window repeats itself cyclically.