Variables classes

Type

Class

Global variable list

Local variable list

Definition

Program

FUN

FB

Global variables

VAR_GLOBAL

l

Non-hold global variable

VAR_GLOBAL_RETAIN

l

Hold-type global variable

VAR_GLOBAL_CONSTANT

l

Constant global variable

VAR_EXTERNAL

l

l

l

Non-hold global variable

VAR_EXTERNAL_RETAIN

l

l

l

Hold-type global variable

VAR_EXTERNAL_CONSTANT

l

l

l

Constant global variable

Local variables

VAR

l

l

l

Non-hold local variable

VAR_RETAIN

l

l

Hold-type local variable

VAR_CONSTANT

l

l

l

Constant local variable

VAR_INPUT

l

l

Input variable

VAR_IN_OUT

l

l

Input and output variable

VAR_OUTPUT

l

l

Output variable

VAR_OUTPUT_RETAIN

l

Hold-type output variable

Related topics:

VAR_GLOBAL, non-hold global variables

The value of the global variable can be changed by the PLC program wherever it is used. The initial value of this type of variable will only be read after switching the PLC from PROG to RUN mode or after a power failure.

VAR_GLOBAL_RETAIN, hold-type global variables

Variables of this type are holding variables. The value of a holding variable is retained after a power failure, or after switching the PLC from PROG to RUN mode.

VAR_GLOBAL_CONSTANT, constant global variables

The value of constant variables remains unchanged throughout the entire program. It cannot be changed by the PLC program. These variables do not occupy any addresses in the PLC and are inserted as constant numbers into the program code.

VAR_EXTERNAL, external variables

External variables are references to global variables. They allow usage of global variables in POUs.Variables of this class can be declared in any POU type and are used, e.g. to store intermediate results. Their values remain unchanged from one call to the next. Memory areas for these variables cannot be defined by the user, but are automatically assigned by the compiler.The initial value of this type of variable will only be read after switching the PLC from PROG to RUN mode or after a power failure.

VAR_EXTERNAL_CONSTANT, external constant variables

External variables are references to global variables. They allow usage of global variables in POUs.The value of constant variables remains unchanged throughout the entire program. It cannot be changed by the PLC program. These variables do not occupy any addresses in the PLC and are inserted as constant numbers into the program code.The initial value of a holding variable is read only after a cold start, i.e. when a program is downloaded to the PLC or when the INITIALIZE switch is activated in PROG mode.

Related topics:

VAR_EXTERNAL_RETAIN, external hold-type variables

External variables are references to global variables. They allow usage of global variables in POUs. The value of a holding variable is retained after a power failure, or after switching the PLC from PROG to RUN mode.

NOTE
If under Extras > Options > Compile options > Code generation, you activated Initialize all variables except global retain variables with explicit addresses, variables for which the user assigned addresses are not reinitialized.
Related topics:

VAR, non-hold variables

Variables of this class can be declared in any POU type and are used, e.g. to store intermediate results. Their values remain unchanged from one call to the next. Memory areas for these variables cannot be defined by the user, but are automatically assigned by the compiler. The initial value of this type of variable will only be read after switching the PLC from PROG to RUN mode or after a power failure.

VAR_RETAIN, hold-type variables

The value of a holding variable is retained after a power failure, or after switching the PLC from PROG to RUN mode.
NOTE
If under Extras > Options > Compile options > Code generation, you activated Initialize all variables except global retain variables with explicit addresses, variables for which the user assigned addresses are not reinitialized.

VAR_CONSTANT, constant variables

The value of constant variables remains unchanged throughout the entire program. It cannot be changed by the PLC program. These variables do not occupy any addresses in the PLC and are inserted as constant numbers into the program code.

VAR_INPUT, input variables

Variables of this class enable parameters to be transferred to a function or function block. The variables have to be declared in the header of the function or function block. Variables of this class may not be used in PRG type POUs.

(1)

input variables

(2)

function

NOTE

The value of an input variable can only be written within the calling POU, not within its own POU (except when the variable is being forced). Other POUs can read the input variable.

VAR_IN_OUT, input/output variables

Variables of this class can be modified within the function program. Before jumping into the function program, the current parameters are copied to the formal parameters; after the return jump, the formal parameters will be copied back to the current parameters.

Formal parameters in the function program can be read and written.

VAR_OUTPUT, output variables

Variables of this type can be used in function blocks only. The initial value of this type of variable will only be read after switching the PLC from PROG To RUN mode or after a power failure.

NOTE
  • The value of an output variable can only be written within the function block in which it was declared. Other POUs can read the output variable.

  • In contrast to function blocks, functions have only one output, which has the name of the function, e.g. Fun_Desc:

VAR_OUTPUT_RETAIN, hold-type output variables

Variables of this type can be used in function blocks only. The initial value of this type of variable will only be read after switching the PLC from PROG To RUN mode or after a power failure.

NOTE
  • If under Extras > Options > Compile options > Code generation, you activated Initialize all variables except global retain variables with explicit addresses, variables for which the user assigned addresses are not reinitialized.

  • The value of an output variable can only be written within the function block in which it was declared. Other POUs can read the output variable.

  • In contrast to function blocks, functions have only one output, which has the name of the function, e.g. Fun_Desc:

Modified on: 2019-12-10Feedback on this pagePanasonic hotline