Files
Adeco_20220119-01/TC3_CNCPLCBase/OEM/FB_AnschlagAbsaugung.TcPOU
Matthias Heisig 51d6e7e5c4 Initial commit
2024-10-22 14:22:54 +02:00

147 lines
3.7 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.6">
<POU Name="FB_AnschlagAbsaugung" Id="{268e7bad-7237-4eb6-ae17-e2c840d2dcaa}" SpecialFunc="None">
<Declaration><![CDATA[FUNCTION_BLOCK FB_AnschlagAbsaugung
VAR_INPUT
bCmdPosition : BOOL;
bReset : BOOL;
fTargetPosition : LREAL;
bEnable : BOOL;
bCmdStartHoming : BOOL;
bHomeSwitch : BOOL;
END_VAR
VAR_OUTPUT
bNotEnableDrive AT %Q* : BOOL;
bDone : BOOL;
bHomed : BOOL;
END_VAR
VAR
refAxis : AXIS_REF;
axisPower : MC_Power;
axisHoming : MC_Home;
axisMoveAbs : MC_MoveAbsolute;
bStartHoming : BOOL;
bStartMoveAbs : BOOL;
rtStartHoming : R_TRIG;
rtHomingDone : R_TRIG;
rtStartMoving : R_TRIG;
rtMoveDone : R_TRIG;
rtReset : R_TRIG;
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[bNotEnableDrive := NOT bEnable;
refAxis.ReadStatus();
rtStartHoming(CLK := bCmdStartHoming);
rtStartMoving(CLK := bCmdPosition);
rtReset(CLK := bReset);
axisPower(
Axis := refAxis,
Enable := bEnable,
Enable_Positive := TRUE,
Enable_Negative := TRUE,
Override := 100);
axisHoming(
Axis := refAxis,
Execute := bStartHoming,
HomingMode := MC_HomingMode.MC_DefaultHoming,
bCalibrationCam := NOT bHomeSwitch);
rtHomingDone(CLK := axisHoming.Done);
axisMoveAbs(
Axis := refAxis,
Execute := bStartMoveAbs,
Position := fTargetPosition,
Velocity := 50,
Acceleration := 0,
Deceleration := 0,
Jerk := 0);
rtMoveDone(CLK := axisMoveAbs.Done);
// Starte die Referenzpunktfahrt nur wenn die Achse auch aktiv ist
IF axisPower.Status AND rtStartHoming.Q THEN
bDone := FALSE;
bStartHoming := TRUE;
END_IF
IF rtHomingDone.Q THEN
bDone := TRUE;
bStartHoming := FALSE;
END_IF
// Starte das positionieren nur wenn die Achse aktiv und referenziert ist
IF axisPower.Status AND refAxis.Status.Homed AND rtStartMoving.Q THEN
bDone := FALSE;
bStartMoveAbs := TRUE;
END_IF
IF rtMoveDone.Q THEN
bDone := TRUE;
bStartMoveAbs := FALSE;
END_IF
bHomed := refAxis.Status.Homed;
// Reset
IF rtReset.Q THEN
bDone := FALSE;
bStartHoming := FALSE;
bStartMoveAbs := FALSE;
END_IF]]></ST>
</Implementation>
<LineIds Name="FB_AnschlagAbsaugung">
<LineId Id="9" Count="0" />
<LineId Id="20" Count="0" />
<LineId Id="19" Count="0" />
<LineId Id="51" Count="0" />
<LineId Id="50" Count="0" />
<LineId Id="102" Count="0" />
<LineId Id="110" Count="0" />
<LineId Id="25" Count="0" />
<LineId Id="24" Count="0" />
<LineId Id="26" Count="1" />
<LineId Id="29" Count="2" />
<LineId Id="43" Count="4" />
<LineId Id="49" Count="0" />
<LineId Id="105" Count="0" />
<LineId Id="83" Count="7" />
<LineId Id="123" Count="0" />
<LineId Id="57" Count="1" />
<LineId Id="42" Count="0" />
<LineId Id="39" Count="0" />
<LineId Id="28" Count="0" />
<LineId Id="100" Count="0" />
<LineId Id="40" Count="1" />
<LineId Id="54" Count="0" />
<LineId Id="53" Count="0" />
<LineId Id="101" Count="0" />
<LineId Id="55" Count="1" />
<LineId Id="92" Count="0" />
<LineId Id="91" Count="0" />
<LineId Id="93" Count="1" />
<LineId Id="106" Count="0" />
<LineId Id="95" Count="0" />
<LineId Id="119" Count="0" />
<LineId Id="118" Count="0" />
<LineId Id="120" Count="0" />
<LineId Id="122" Count="0" />
<LineId Id="121" Count="0" />
<LineId Id="158" Count="0" />
<LineId Id="157" Count="0" />
<LineId Id="112" Count="0" />
<LineId Id="111" Count="0" />
<LineId Id="113" Count="1" />
<LineId Id="116" Count="1" />
<LineId Id="115" Count="0" />
</LineIds>
</POU>
</TcPlcObject>