What is the proper and the easiest way to call programs through looping of array of programs, or pointer of program?
instead of calling the programs one by one:
prog1(inputX: 11);
prog2(inputY: 12);
prog3(inputZ: 13);
similar like:
VAR
programsToCall : ARRAY [1..3] OF PROGRAM;
END_VAR
programsToCall[1] := prog1(inputX: 11);
programsToCall[2] := prog2(inputY: 12);
programsToCall[3] := prog3(inputZ: 13);
You cannot create an array of Programs. Create a Function Block for this purpose instead of a program.
You can create an array of FB instances and call each instance in a loop.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi!
What is the proper and the easiest way to call programs through looping of array of programs, or pointer of program?
instead of calling the programs one by one:
prog1(inputX: 11);
prog2(inputY: 12);
prog3(inputZ: 13);
similar like:
VAR
programsToCall : ARRAY [1..3] OF PROGRAM;
END_VAR
programsToCall[1] := prog1(inputX: 11);
programsToCall[2] := prog2(inputY: 12);
programsToCall[3] := prog3(inputZ: 13);
FOR i := 1 TO 3 DO
programsToCall[i] ();
END_FOR
Thanks.
Related
Talk.ru: 1
Talk.ru: 2
Talk.ru: 3
Last edit: szotyi 2024-08-28
You cannot create an array of Programs. Create a Function Block for this purpose instead of a program.
You can create an array of FB instances and call each instance in a loop.