Цитата Сообщение от EFrol Посмотреть сообщение
Код:
function_block func
    
    var_input
        Stop, Start : bool;
    end_var
    
    var_output 
        Q1, Q2, Q3, Q4, Q5 : bool;
    end_var
    
    var 
        tmr : SYS.TON;
        Q : bool;
        nQ : udint;
    end_var

    if Start and nQ = 0 then nQ := 1; Q := true; end_if     // Пуск алгоритма
    if Not Stop then nQ := 0; Q := false; end_if            // Стоп алгоритма
    if Q then tmr.T := T#1s; else tmr.T := T#2s; end_if     // Выдача - 1s, пауза - 2s 

    tmr(I := nQ > 0);   // Отсчёт времени
    if tmr.Q then       // Смена состояния выхода
        Q := not Q; tmr(I := false);
        if Q then       // Смена выхода
            nQ := nQ + 1; if nQ > 5 then nQ := 0; end_if
        end_if
    end_if
 
    Q1 := Q and nQ = 1;
    Q2 := Q and nQ = 2;
    Q3 := Q and nQ = 3;
    Q4 := Q and nQ = 4;
    Q5 := Q and nQ = 5;

end_function_block
Благодарю! Очень красивое решение! Глядя на свой код в 100+ строк, понимаю что нужно расти.