Tabular editor view
The tabular view of the editor provides columns for the usual definitions for variable declaration: , , , , , and (pragma) . The particular declarations are inserted as numbered lines.
To add a new line of declaration above an existing one, first select this line and execute the command from the toolbar or the contextual menu.
To add a new declaration at the end of the table, click beyond the last existing declaration line and also use the
command.The newly inserted declaration by default first uses scope
and the recently entered data type. The input field for the obligatory variable opens automatically. Enter a valid identifier and close the field by pressing the key or by clicking another part of the view.Double-click a table cell to open the respective possibilities to enter a value.
Double-click the
to open a list from which you can choose the desired scope and scope attribute keyword (flag).Type in the
directly or click the button to use the or the wizard.Type in the dialog box. This is useful especially in case of arrays and structured variables.
value directly or click the button to open theEach variable is declared in a separate line where the lines are numbered.
You can change the order of lines (line numbers) by selecting a line and move it one up or down by the or
command from the toolbar or the contextual menu.
You can sort the list of declarations according to each of the columns by clicking the header of the respective column.
To delete one or several declarations, select the respective lines and press the button in the toolbar.
For the declaration of array variables, use the arrow button
at the right side of the field and select . The dialog box opens.Fill at least the fields marked with a red exclamation mark icon. Define the
s by entering the lower and upper limits, and the of the variable. You can click the arrow button to open the dialog box or another for declaring the base type.
You can define an array of variable length with [*,*,*]
. Arrays of variable length can only be used in VAR_IN_OUT declarations of function blocks, methods, and functions. To declare an array of variable length, enter an asterisk *
for each dimension. This results in ARRAY [*..*] OF INT
. After you have confirmed with , adapt the dimension string to [*]
(one asterisk only).
Example for a two-dimensional array of variable length:
ARRAY [*,*]
The
area of the dialog box provides a preview of the configured array declaration.For further information, refer to the Arrays description.
Click
to close the declaration dialog box. The variable declaration appears in the declaration editor in accordance to the IEC syntax.dialog box
The
of the variable are displayed with the present initialization values. Select the desired variables and edit the initialization value in the field below the listing. Then click the button. To restore the default initializations, click the button.Press
+ to insert line breaks in the entry.
If the variable to be initialized is a function block instance with an extended FB_Init
method, an additional table is displayed that lists the FB_Init
parameters. The following differences apply to this table in contrast to the table:
Assign an initialization value to each variable. Otherwise, the
button remains disabled.Complex data types (structures, arrays) cannot be expanded and the components they contain cannot be displayed. Use a corresponding variable to initialize complex data types.
FB_Init
parameters are marked in the dialog box by a corresponding symbol that is displayed after the initialization value.
You can edit the declaration header in the
dialog box. Open it by clicking the header bar of the editor (PROGRAM PLC_PRG in the figure above) or via the command .dialog box
The
dialog box provides the following elements:
Element |
Description |
---|---|
|
Insert type (from the selection list) and name of the POU object. |
|
Insert a comment. Press + to insert line breaks. |
|
Opens the dialog box (see further below in this chapter) for inserting pragmas and attributes. |
In the textual editor view.
dialog box, click the button to open the dialog box. It allows you to enter multiple attributes and pragmas in text format. Insert them without enclosing {} braces, use a separate line per each. For the example shown in the following image, see the corresponding textual view above in the graphic of thedialog box