de:project_s7:init_one_times

Differences

This shows you the differences between two versions of the page.

de:project_s7:init_one_times [2022/04/21 15:01] ()
 1:  1:
 +====== Init only one times ======
 +{{:de:project_s7:uk.png?16|english}} It is often necessary for the PLC to run an init program block for a specific task.
 +This "init" block only needs to run once and start with a delay compared to turning on the PLC (waiting for, for example, the unit to establish stable communication). This short module performs this task.
  
 +{{:de:project_s7:de.png?16|deutsch}} Oft muss die SPS einen Init-Programmblock für eine bestimmte Aufgabe ausführen.
 +Dieser "Init"-Block muss nur einmal ausgeführt werden und mit einer Verzögerung im Vergleich zum Einschalten der SPS beginnen (beispielsweise darauf warten, dass das Gerät eine stabile Kommunikation herstellt). Dieses kurze Modul führt diese Aufgabe aus.
 +
 +{{:de:project_s7:hu.png?16|magyar}} Gyakran szükséges, hogy egy init programblokkot futtasson a PLC egy adott feladathoz. 
 +Ennek az "init" blokknak csupán egyszer kell futnia, és a PLC bekapcsolásához képest késleltetve kell indulnia (kivárva, míg például az adott egység stabil kmmunikációt épít fel). Ez a rövid modul ezt a feladatot látja el.
 +
 +<WRAP center round download 80%>
 +**SCL-Programm download : ** {{ :de:project_s7:initonetime.scl |initonetime.scl}}  \\  \\  
 +Der Quellcode enthält eine Beschreibung eines scl-Codes (siehe Quellcode unten). Der Code kann im TIA-Portal geöffnet und übersetzt werden.
 +</WRAP>
 +
 +From file (from 2020.10.30) **{{dlcounter>file?de:project_s7:initonetime.scl}}** downloads.
 +
 +Das Programm wurde mit **TIA Portal 16** getestet. 
 +
 +<hidden Klicken Sie hier, um den Code anzuzeigen - Click here to view the code>
 +<code pascal>
 +FUNCTION_BLOCK "initOneTime"
 +{ S7_Optimized_Access := 'TRUE' }
 +VERSION : 0.1
 +   VAR 
 +      newstart : Bool := FALSE;   // newstart delay on-time
 +      initOneTime : Bool := FALSE;   // init only one times
 +      waitAfterNewStart {InstructionName := 'TON_TIME'; LibVersion := '1.0'; S7_SetPoint := 'False'} : TON_TIME;   // delay time FB
 +      test { S7_SetPoint := 'True'} : Int := 0;   // test for check the functionality
 +   END_VAR
 +
 +
 +BEGIN
 + // init one times with delay
 + // Vamos Sandor 2020
 + // 
 + // It is often necessary for the PLC to run an init program block for a specific task.
 + // This "init" block only needs to run once and start with a delay compared to turning on the PLC (waiting for, for example, the unit to establish stable communication). This short module performs this task.
 +
 + #waitAfterNewStart(IN:=NOT(#newstart),   // delay time FB
 +                    PT:=t#1m);            // delay time can settings, in here to example 1 minute
 +
 + #initOneTime := FALSE;                   // default value to variable
 +
 + IF #waitAfterNewStart.Q THEN             // the delay time has expired
 +     #newstart := TRUE;                   // newstart is ready
 +     #initOneTime := TRUE;                // one time set only one times
 + END_IF;
 +
 + IF #initOneTime THEN
 +     // the beginning of the init block
 +     
 +     #test := #test + 1;
 +     
 +     // the end of the init block
 +       
 + END_IF;
 +
 + // check the test function
 + // - runninfg only one times (count to 1)
 + // - running with delay (1 min from PLC new start)
 + #test := #test;
 +END_FUNCTION_BLOCK
 +</code>
 +</hidden>
 +
 +{{page>de:project_s7:foot}}
  • de/project_s7/init_one_times.txt
  • 2022/04/21 15:01
  • ()