998 B
998 B
This FC was crafted to facilitate the calling of FC19 by utilizing all disaggregated parameters, rather than relying solely on the UDT structure. The intent is to minimize typing errors. Also was remake in SCL to be more readable.
IF #Timer.ST = 32700 THEN
// Timer was reached
#Timer.Q := TRUE;
END_IF;
// Check elapsed time
IF (#Clock_Sec - #Timer.ST) > #Timer.TW THEN
// Time reached now : elapsed time > Timer.TW
#Timer.Q := TRUE;
ELSIF (#Clock_Sec < #Timer.ST) AND (32000 - #Timer.ST) + #Clock_Sec > #Timer.TW THEN
// Clock_Sec goes from 32000 to 0 and the elapsed time > Timer.TW
#Timer.Q := TRUE;
END_IF;
// Not Active
IF NOT #Timer.S THEN
// Not Enable
#Timer.ST := #Clock_Sec;
#Timer.Q := FALSE;
ELSE
// Save the acumulation
#Timer.ACT := #Clock_Sec - #Timer.ST;
END_IF;
// Active
IF #Timer.Q THEN
// Timer is Active
#Timer.ACT := #Timer.TW;
#Timer.ST := 32700;
END_IF;