A program is a POU which returns several values during operation. Programs are recognized globally throughout the project. All values are retained from the last time the program was run until the next.
Programs can be called. A program call in a function is not allowed. There are also no instances of programs⮫ “Function”.
If a POU calls a program, and if thereby values of the program are changed, then these changes are retained the next time the program is called, even if the program has been called from within another POU.
This is different from calling a function block. There only the values in the given instance of a function block are changed.
These changes therefore play a role only when the same instance is called.
A program declaration begins with the keyword PROGRAM. Regard the recommendations on the naming of identifiers⮫ “Recommendations on the naming of identifiers”.
If you would like to set input and/or output parameters when you call the program, you can do this in the supported text languages by assigning values to the parameters after the program name in parentheses (for input parameters this assignment takes place using ":=" just as with the initialization of variables at the declaration position, for output parameters "=>" is to be used)⮫ “Variables declaration”.
If the program is inserted via input assistant ([F2]) with option “With arguments” in the implementation window of a POU in text language, it will be displayed automatically according to this syntax with all of its parameters. But you not necessarily must assign these parameters.
Examples for program calls
In ST
PRGexample2; Erg := PRGexample2.out_var; or with assigning the parameters (input assistant "With arguments", see above): PRGexample2(in_var:=33, out_var=>erg );
In FBD
