0

現在、特定のスキャン サイクルで実行したい特定のコマンドを実行する PLC のコーディングに取り組んでいます。

構造化テキストでプログラムをコーディングして、「n」スキャン サイクルでのみ実行するステートメントにフラグを立てる方法はありますか?

前もって感謝します。

4

1 に答える 1

1

スキャン サイクルごとに 1 ずつインクリメントされるカウンターを使用してから、ケース ストラクチャを使用して、スキャンごとにアクティブなコマンドを制御できます。

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;
于 2016-07-14T14:43:26.963 に答える