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.

68 lines
1.3 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.12">
<POU Name="TP_X" Id="{94610de2-d47a-4301-b858-64fba677c68d}" SpecialFunc="None">
<Declaration><![CDATA[FUNCTION_BLOCK TP_X
VAR_INPUT
IN : BOOL;
PT : TIME;
END_VAR
VAR_OUTPUT
Q : BOOL;
ET : TIME;
END_VAR
VAR
edge : BOOL;
start : TIME;
tx: TIME;
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[(*
version 1.3 17. dec. 2008
programmer hugo
tested by oscat
retriggerable edge triggered pulse similar to TP but with a retrigger function
if the pt input is 0 then output is always low.
*)
(* @END_DECLARATION := '0' *)
(* read system_time *)
tx := DWORD_TO_TIME(T_PLC_MS());
(* rising edge trigger *)
IF IN AND NOT edge THEN
start := tx;
Q := PT > t#0ms;
ELSIF Q THEN
ET := tx - start;
IF ET >= PT THEN
Q := FALSE;
ET := t#0ms;
END_IF;
END_IF;
edge := IN;
(* revision history
hm 4. aug 2006 rev 1.0
original version
hm 17. sep 2007 rev 1.1
replaced time() with T_PLC_MS() for compatibility reasons
hm 19. oct. 2008 rev 1.2
renamed to TP_R to TP_X for compatibility reasons
hm 17. dec. 2008 rev 1.3
code optimized
*)
]]></ST>
</Implementation>
<LineIds Name="TP_X">
<LineId Id="23" Count="39" />
<LineId Id="9" Count="0" />
</LineIds>
</POU>
</TcPlcObject>