Skip to main content

Variable Declaration Editor

The variable declaration editor is used to declare the variables in GVLs and Safety POUs of CODESYS Safety Extension safety applications. It provides declarations in tabular form.

The Pin information or, if the object version deviates from the pinned version or if the safety application has not yet been pinned, In work is displayed in the top line. For more detailed information about the Pin information, see: Pinning

The editor contains the following columns:

  • Line

  • Scope

  • Name: Variable name (identifier)

  • Type: Data type

  • Initial value:

  • Comment:

In addition to the standard commands Cut, Copy, Paste, and Delete, the context menu also includes the Safety commands.

Insert Variable Declaration

Toggle network comment state (if a line is selected) available.

Changing a variable declaration

Existing declarations can be changed by double-clicking the respective field in the declaration table. When you double-click the field of the Scope, Type, or Initial value columns, a corresponding list box of the available options opens.

Figure 30. Example: List box for the scope of the VarB1 variable
Example: List box for the scope of the VarB1 variable


Change markings in the declaration part of the editor

Newly edited, changed and deleted variable declarations are marked in color for a better overview:

Only the fields affected by the last-performed editing operation are highlighted. The marking of the last-performed action is always visible. All markings are removed upon closing the object (POU or GVL).

. Markings in the declaration part
  • Green: Newly added fields

  • Red: Changed fields

  • SafetyVarDelIcon.png in the Line column of the deleted variable

  • The line with the change marking is marked on the left by a red bar.

Figure 31. Example of change marker: Data type of the variables iVar1 was changed
Example of change marker: Data type of the variables iVar1 was changed


Figure 32. Example of change marker: New variable 'varB2' was added
Example of change marker: New variable 'varB2' was added


Tip

The commands Copy,Paste, Cut, Delete, Undo, and Search/Replace can be used for working in this editor. The Cut, Copy, and Paste commands can only be executed between safety objects (GVL/POU), not between safety and standard objects (GVL/POU).