
(* Delays rising edge propagation for a certain number of function block calls *)
FUNCTION_BLOCK Delay
	IF Execute = FALSE THEN
		Done := FALSE;
		CyclesSinceRising := 0;
	END_IF;

	IF (Execute = TRUE) AND (CyclesSinceRising >= Cycles)THEN
		Done := TRUE;
	END_IF; 

	IF (Execute = TRUE) AND (Done = FALSE) THEN
		CyclesSinceRising := CyclesSinceRising + 1;
	END_IF;
END_FUNCTION_BLOCK
