Editors Between the key words VAR_OUTPUT and END_VAR, all variables are declared that serve as output variables of a POU. That means that these values are carried back to the POU making the call. There they can be answered and used further. Example: VAR_OUTPUT out1:INT; (* 1. Outputvariable*) END_VAR Input and Output Variable Between the key words VAR_IN_OUT and END_VAR, all variables are declared that serve as input and output variables for a POU. With this variable, the value of the transferred variable is changed ("transferred as a pointer", Call-by- Reference). That means that the input value for such variables cannot be a constant.
For this reason, even the VAR_IN_OUT variables of a function block can not be read or written directly from outside via . Example: VAR_IN_OUT inout1:INT; (* 1. Input/Outputvariable *) END_VAR Local Variables Between the keywords VAR and END_VAR, all of the local variables of a POU are declared. These have no external connection; in other words, they can not be manipulated from the outside. Example: VAR loc1:INT; (* 1. Local Variable*) END_VAR Remanent Variables Remanent variables can retain their value throughout the usual program run period. These include Retain variables and Persistent variables. Retain variables are identified by the keyword RETAIN .
These variables maintain their value even after an uncontrolled shutdown of the controller as well as after a normal switching off and on of the controller (resp. at the command 'Online' 'Reset'. When the program is run again, the stored values will be processed further. A concrete example would be an piece-counter in a production line, that recommences counting after a power failure. Retain-Variables are reinitialized at a new download of the program unlike persistent variables. All other variables are newly initialized, either with their initialized values or with the standard initializations. Example:
VAR RETAIN rem1:INT; (* Retain Variable*) END_VAR If a local variable in a program is declared as RETAIN, exactly this variable is stored in the retain area (like a global retain variable). If a local variable in a function block is declared as RETAIN, the complete instance of this function block is stored in the retain area (all data of the function block), but only the declared retain variable is treated as such. If a local variable in a function is declared as RETAIN, this has no effect. The variable is not stored in the retain area. Persistent variables In addition to the remanent variables specified with RETAIN, there is another class of remanent variables.
These variables are saved with their instance path and symbol name. The generation of symbols must be selected for this. While the variables saved with RETAIN are no longer available after a "Rebuild all" of the TX1200 117 Version: 1.3