FUNCTION talkt_5_sec : VOID
VAR_INPUT
start,stop:BOOL;
overcurrent:BOOL;
END_VAR
VAR_OUTPUT
step1,step2,step3,step4:BOOL;
END_VAR
VAR_TEMP
t_out:S5TIME;
t_bi:WORD;
t_q:BOOL;
pe:BOOL;
con:INT;
tmr_set:BOOL;
END_VAR
BEGIN
IF start AND NOT pe THEN
con:=1;
tmr_set:=1;
ELSIF NOT (stop AND overcurrent) THEN
con:=0;
tmr_set:=0;
END_IF;
pe:=start;
CASE con OF
1: IF tmr_set AND t_q THEN con:=2; step1:=1; step2:=0; step3:=0; step4:=0; END_IF;
2: IF tmr_set AND t_q THEN con:=3; step1:=0; step2:=1; step3:=0; step4:=0; END_IF;
3: IF tmr_set AND t_q THEN con:=4; step1:=0; step2:=0; step3:=1; step4:=0; END_IF;
4: IF tmr_set AND t_q THEN con:=1; step1:=0; step2:=0; step3:=0; step4:=1; END_IF;
END_CASE;
t_out:=S_ODT(t_no:=t1, s:=tmr_set AND NOT t_q, tv:=t#2s, r:=false, bi:=t_bi, q:=t_q);
END_FUNCTION