Using the Declaration Editor

The declaration editor is used for declaring variables in variable lists and POUs.

If the declaration editor is used in conjunction with a programming language editor, it appears as declaration part in the upper part of a POU window.

The declaration editor offers two possible views: textual (Using the Declaration Editor 1:) or tabular (Using the Declaration Editor 2:). In the dialog Tools > Options > TwinCAT > PLC Environment > Declaration editor you can define whether either only the text-based view or only the tabular view is available, or whether the user can choose between the two views via the buttons on the right of the editor window.

See also:

Declarations via the textual declaration editor

A programming object (POU or GVL) of a project is open. The focus is on the textual declaration editor.
1. Enter the variable declarations in the correct syntax. Use [F2] or the Input Assistant option in the context menu to open the Input Assistant dialog for selecting the data type or a keyword. Use the Auto Declare command in the context menu to open the Auto Declare dialog.
When variables are declared, keywords are automatically corrected and highlighted.

See also:

Declarations via the tabular declaration editor

A programming object (POU or GVL) of a project is open. The focus is on the tabular declaration editor.
1. Click the button Using the Declaration Editor 3: in the declaration header or select the Auto Declare command in the context menu to open the Auto Declare dialog.
TwinCAT inserts a new row for a variable declaration, and the input field for the variable name opens.
2. Enter a valid variable identifier.
3. Open the other fields of the declaration line by double-clicking as required, and select the required information from the selection lists or via the displayed dialogs.
The correct syntax is used automatically when variables are declared.

See also: