Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
21
Добавлен:
11.10.2020
Размер:
3.39 Mб
Скачать

166 The Editors

Declaration Editor

In the Address field, you can bind the variable being declared to an IEC address (AT declaration).

If applicable, enter a Comment. The comment can be formatted with line breaks by using the key combination <Ctrl> + <Enter>.

By pressing OK, the declaration dialog is closed and the variable is entered in the corresponding declaration editor in accordance to the IEC syntax.

Note:

The dialog box for variable declaration you also get by the command 'Edit' 'Declare Variable'. If the cursor is resting on a variable in Online mode, the Autodeclare window can be opened with <Shift><F2> with the current variable-related settings displayed.

5.2.17Line Numbers in the Declaration Editor

In offline mode, a simple click on a special line number will mark the entire text line.

In the online mode, a single click on a specific line number will open up or close the variable in this line, in case a structural variable is involved.

5.2.18Declarations as tables

If the Declarations as table option is activated in the Options dialog box in the category, the declaration editor looks like a table. As in a card-index box, you can select the register cards of the respective variable types and edit the variables.

For each variable you are given the following entry fields.

Name:

Input the identifier of the variable.

Address:

If necessary, input the address of the variable (AT

 

declaration)

Type:

Input the type of the variable. (Input the function block

 

when instantiating a function block)

Initial:

Enter a possible initialization of the variable

 

(corresponding to the ":= " assignment operator).

Comment:

Enter a comment here.

Both of the display types of the declaration editor can be changed without causing any problems. In the online mode, there are no differences for the display.

In order to edit a new variable, select the 'Insert' 'New Declaration' command.

WAGO-I/O-SYSTEM 759 WAGO-I/O-PRO 32

The Editors 167

Declaration Editor

x Declaration Editor as a Table

5.2.19'Insert' 'New Declaration'

With this command you bring a new variable into the declaration table of the declaration editor. If the present cursor position is located in an field of the table, then the new variable will be pasted in the preceding line; otherwise, the new variable is pasted at the end of the table. Moreover, you can paste a new declaration at the end of the table by using the right arrow key or the tab key in the last field of the table.

You will receive a variable that has "Name" located in the Name field, and "Bool" located in the Type field, as its default setting. You should change these values to the desired values. Name and type are all that is necessary for a complete declaration of variables.

5.2.20Pragma instructiion

The pragma instruction is used to affect the properties of a variable concerning the compilation process. It can be used in with supplementary text in a program line of the declaration editor or in its own line.

The pragma instruction is enclosed in curly brackets, upperand lower-case are ignored: { <Instruction text> }

If the compiler cannot meaningfully interpret the instruction text, the entire pragma is handled as a comment and read over. A warning is issued, however: "Ignore compiler directive ‚<Instruction text>’!"

Depending on the type and contents of pragma, the pragma either operates on the line in which it is located or on all subsequent lines until it is ended by an appropriate pragma, or the same pragma is executed with different parameters, or the end of the file is reached. By file we mean here: declaration part, implementation portion, global variable list, type declaration.

The opening bracket may immediately follow a variable name. Opening and closing brackets must be located on the same line.

The following pragma may currently be used:

WAGO-I/O-SYSTEM 759 WAGO-I/O-PRO 32

168 The Editors

Declaration Editor

{flag [<flags>] [off|on]}

<flags> can be a combination of the following flags:

noinit:

The variable will not be initialized.

nowatch:

The variable can not be monitored

noread:

The variable is exported to the symbol file without

 

read permission

nowrite:

The variable is exported to the symbol file without

 

write permission

noread, nowrite:

Die Variable wird nicht in die Symboldatei

 

exportiert

With the "on" modifier, the pragma operates on all subsequent variable declarations until it is ended by the pragma {flag off}, or until overwritten by another {flag <flags> on} pragma.

Without the "on" or "off" modifier, the pragma operates only on the current variable declaration (that is the declaration that is closed by the next semicolon).

Examples:

The variable a will not be initialized and will not be monitored. The variable b will not be initialized:

VAR

a

:

INT

{flag noinit, nowatch};

b

:

INT

{flag noinit };

END_VAR

VAR

{flag noinit, nowatch on} a : INT;

{flag noinit on} b : INT;

{flag off}

END_VAR

Neither variable will be initialized:

{flag noinit on}

VAR

a : INT; b : INT;

END_VAR

WAGO-I/O-SYSTEM 759 WAGO-I/O-PRO 32

The Editors 169

Declaration Editor

{flag off}

VAR

{flag noinit on} a : INT;

b : INT;

{flag off}

END_VAR

The flags "noread" and "nowrite" are used, in a POU that has read and/or write permission, to provide selected variables with restricted access rights. The default for the variable is the same as the setting for the POU in which the variable is declared. If a variable has neither read nor write permission, it will not be exported into the symbol file.

Examples:

If the POU has read and write permission, then with the following pragmas variable a can only be exported with write permission, while variable b can not be exported at all:

VAR

a

:

INT

{flag noread};

b

:

INT

{flag noread, nowrite};

END_VAR

VAR

{flag noread on} a : INT;

{flag noread, nowrite on} b : INT;

{flag off}

END_VAR

Neither variable a nor b will be exported to the symbol file:

{ flag noread, nowrite on }

VAR

a : INT; b : INT; END_VAR

{flag off}

VAR

{ flag noread, nowrite on} a : INT;

WAGO-I/O-SYSTEM 759 WAGO-I/O-PRO 32

Соседние файлы в папке 759-332