Variables

Top 

 

In the declaration part of functions and organization blocks temporary variables can be declared in which values, that are only needed during the process of the FC, can be saved. In function blocks also static variables can be declared which are saved in the instance-DB and which keep their value from one call of the FB to the next one (with the same IDB). In principle all unused inputs, outputs and the whole marker area, and all data in data blocks which are not in -, out- or In-Out-parameter in an instance DB, can be used as variables.

It will increase the readability of a program if you use variables as local as possible. The current content of a temporary variable can only be determined by looking at the program code of the current block that preceded the use, no reader of your program has to assume that this value could be manipulated from anywhere else in the program.