2016-07-12 83 views

Antwort

0

Sie können einen Zähler verwenden, der eine für jeden Zyklus inkrementiert wird, und dann eine Gehäusestruktur zu steuern, welche Befehle aktiv sind bei jeder Abtastung:

VAR 
    i: INT; 
END_VAR 

(* Main code to be executed at each scan cycle *) 
(* The commands could be either actions to MAIN() or separate POUs *) 
i := i + 1; 
IF i > 10 THEN 
    i := 1; 
END_IF; 

CASE i OF 
    1: (* Call one command *) 
    Command1(); 
    2, 4, 6, 8, 10: (* These scans all call the same command *) 
    Command2(); 
    5: (* Call 3 different commands *) 
    Command3(); 
    Command4(); 
    Command5(); 
    (* Scans 3, 7 and 9 do nothing *) 
END_CASE;