You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
1.5 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.12">
<POU Name="LimitValueINT" Id="{561f7915-f04f-4878-b6c4-f0067cb195bf}" SpecialFunc="None">
<Declaration><![CDATA[FUNCTION LimitValueINT : INT
VAR_INPUT
LowerLimit: INT; (* 1st input variable - Lower limit *)
Input: INT; (* 2nd input variable *)
UpperLimit: INT; (* 3rd input variable - Upper limit *)
END_VAR
VAR
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[(*
The 1st LowerLimit input variable forms the lower and the 3rd UpperLimit input variable the upper limit value.
If the 2nd Input variable is within this limit, it will be transferred to the output variable.
If it is above this limit, the upper limit value will be transferred;
if it is below this limit the lower limit value will be transferred.
*)
IF Input > UpperLimit THEN
LimitValueINT := UpperLimit; (* If input is above upper limit, set output to upper limit *)
ELSIF Input < LowerLimit THEN
LimitValueINT := LowerLimit; (* If input is below lower limit, set output to lower limit *)
ELSE
LimitValueINT := Input; (* If input is within limits, pass it through *)
END_IF;]]></ST>
</Implementation>
<LineIds Name="LimitValueINT">
<LineId Id="18" Count="0" />
<LineId Id="22" Count="3" />
<LineId Id="20" Count="0" />
<LineId Id="12" Count="5" />
<LineId Id="7" Count="0" />
</LineIds>
</POU>
</TcPlcObject>