103 lines
2.4 KiB
XML
103 lines
2.4 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.6">
|
|
<POU Name="FB_Zentralschmierung" Id="{bcde91c3-50bd-4ca1-8148-e05e13bdb662}" SpecialFunc="None">
|
|
<Declaration><![CDATA[FUNCTION_BLOCK FB_Zentralschmierung
|
|
VAR_INPUT
|
|
bCmdStartCycle : BOOL;
|
|
bCycleSensor : BOOL;
|
|
bReset : BOOL;
|
|
END_VAR
|
|
VAR_OUTPUT
|
|
bError : BOOL;
|
|
bBusy : BOOL;
|
|
END_VAR
|
|
VAR
|
|
bEnablePump AT %Q* : BOOL;
|
|
|
|
rtStartCycle : R_TRIG;
|
|
rtReset : R_TRIG;
|
|
rtCycleSensor : R_TRIG;
|
|
|
|
tonError : TON;
|
|
|
|
nState : INT := 0;
|
|
END_VAR
|
|
]]></Declaration>
|
|
<Implementation>
|
|
<ST><![CDATA[// Start cycle on rising edge
|
|
rtStartCycle(CLK := bCmdStartCycle);
|
|
|
|
// Cycle done on rising edge of sensor
|
|
rtCycleSensor(CLK := bCycleSensor);
|
|
|
|
// Reset on rising edge
|
|
rtReset(CLK := bReset);
|
|
|
|
CASE nState OF
|
|
0: // Idle
|
|
bEnablePump := FALSE;
|
|
bBusy := FALSE;
|
|
bError :=FALSE;
|
|
tonError(IN := FALSE);
|
|
|
|
IF rtStartCycle.Q THEN
|
|
nState := 10;
|
|
END_IF
|
|
|
|
10: // Cycle started
|
|
bEnablePump := TRUE;
|
|
bBusy := TRUE;
|
|
|
|
// Timeout protection (Normal cycle approx. 7 min 40 sec)
|
|
tonError(IN := TRUE, PT := T#15M);
|
|
IF tonError.Q THEN
|
|
nState := 99;
|
|
END_IF
|
|
|
|
// Cacle done
|
|
IF rtCycleSensor.Q THEN
|
|
nState := 0;
|
|
END_IF
|
|
|
|
99: // Error
|
|
bEnablePump := FALSE;
|
|
tonError(IN := FALSE);
|
|
bError := TRUE;
|
|
bBusy := FALSE;
|
|
|
|
IF rtReset.Q THEN
|
|
nState := 0;
|
|
END_IF
|
|
END_CASE]]></ST>
|
|
</Implementation>
|
|
<LineIds Name="FB_Zentralschmierung">
|
|
<LineId Id="18" Count="0" />
|
|
<LineId Id="9" Count="0" />
|
|
<LineId Id="20" Count="0" />
|
|
<LineId Id="19" Count="0" />
|
|
<LineId Id="21" Count="0" />
|
|
<LineId Id="60" Count="0" />
|
|
<LineId Id="59" Count="0" />
|
|
<LineId Id="61" Count="0" />
|
|
<LineId Id="27" Count="0" />
|
|
<LineId Id="26" Count="0" />
|
|
<LineId Id="28" Count="0" />
|
|
<LineId Id="36" Count="0" />
|
|
<LineId Id="51" Count="1" />
|
|
<LineId Id="47" Count="0" />
|
|
<LineId Id="37" Count="0" />
|
|
<LineId Id="30" Count="5" />
|
|
<LineId Id="50" Count="0" />
|
|
<LineId Id="38" Count="0" />
|
|
<LineId Id="67" Count="0" />
|
|
<LineId Id="39" Count="3" />
|
|
<LineId Id="62" Count="0" />
|
|
<LineId Id="66" Count="0" />
|
|
<LineId Id="63" Count="2" />
|
|
<LineId Id="43" Count="3" />
|
|
<LineId Id="48" Count="1" />
|
|
<LineId Id="55" Count="3" />
|
|
<LineId Id="29" Count="0" />
|
|
</LineIds>
|
|
</POU>
|
|
</TcPlcObject> |