Operating the touchprobe function with function blocks
The following example shows how the touchprobe function is operated with the function blocks:
VAR
// Used PLCopen blocks
ConfigTouchProbe : MC_SEW_ConfigTouchProbe;
TouchProbe : MC_TouchProbe;
TriggerRef : MC_TRIGGER_REF;
AbortTrigger : MC_AbortTrigger;
// Variables
xConfigTouchProbe : BOOL;
xActivateTouchProbe : BOOL;
xAbortTrigger : BOOL;
END_VAR
// Use this function block to configure the touch probe function ConfigTouchProbe(Execute:=xConfigTouchProbe,InputNumber:=2,
TriggerEvent:=E_TriggerEvent.RisingEdge,Axis:=Axis1,
TriggerInput:=TriggerRef);
// Activate the touch probe
TouchProbe(Execute:=xActivateTouchProbe,
TriggerInput := TriggerRef,Axis:=Axis1); //Axis1 = name of the logical device
// Abort the trigger if necessary
AbortTrigger(Execute := xAbortTrigger, Axis:=Axis1,TriggerInput:=TriggerRef);