de:project_s7:init_one_times

No renderer 'pdf' found for mode 'pdf'

Init only one times

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.

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.

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.

SCL-Programm download : 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.

From file (from 2020.10.30) downloads.

Das Programm wurde mit TIA Portal 16 getestet.

Klicken Sie hier, um den Code anzuzeigen - Click here to view the code

Klicken Sie hier, um den Code anzuzeigen - Click here to view the code

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

Donate

If you have any further questions or have any issues that you can't handle, please contact me! » Impressum

~~socialite~~

2022/04/21 15:01
  • de/project_s7/init_one_times.txt
  • 2022/04/21 15:01
  • ()