Vous êtes sur la page 1sur 5

Editing data types

Editing data types


Editing data type worksheets using the text editor.......................................................................1

Inserting data types using the Edit Wizard....................................................................................2

i
Editing data type worksheets using the text editor
Data types are declared in data type worksheets within the project subtree 'Data Types'. Data type
worksheets are edited using the text editor.

In order to edit a data type worksheet you first have to open the corresponding worksheet in the
project tree by double clicking on the desired icon.

It is not necessary to edit elementary data types or generic data types. They are predefined in the
system and can be used in POUs without declaring them. Only user defined data types such as
arrays or structures have to be declared in a data type worksheet.

User defined data types are edited using the Edit Wizard or by just typing the lines in the editor
using the keywords TYPE ... END_TYPE as shown in the following example:

TYPE
graph : ARRAY[1..23] OF INT;
END_TYPE

The use of data types depends on your PLC type. Please refer also to your hardware
documentation for restrictions about data types.

1
Inserting data types using the Edit Wizard
You can insert data type declarations in a data type worksheet using the Edit Wizard.

After calling or activating the Edit Wizard in a data type worksheet, by pressing <SHIFT> + <F2> or
<ALT> + <3>, the Edit Wizard is opened or activated. The list box 'Group' contains only one entry:
The group 'Data Types'. The selection area contains the available data types.

You can insert these data types into your data type worksheet. The Edit Wizard inserts pre−edited
constructions, where you just have to replace the green displayed comments by your actual
variable declarations.

For each data type a new declaration block (started with the keyword TYPE and terminated with
END_TYPE) is inserted.

How to proceed:

• Locate the position, where the new data type is to be inserted in the data type worksheet.
This position must not be within another declaration block.
Click the left mouse button to position the text cursor.

• Press <↵> to insert a new line.

• In the list of available data types in the Edit Wizard double click on the desired data type
(e.g. 'ARRAY'). The whole declaration is inserted automatically at the text cursor position
enclosed by the keywords TYPE and END_TYPE. The actual data type names and values
are replaced by comments (green text, enclosed by parentheses and asterisks).

• Replace the comments by the actual declarations.

The following figure shows both, an array and a structure, each inserted using the Edit Wizard. For
each keyword, a new declaration block is inserted.

2
Inserting data types using the Edit Wizard

Vous aimerez peut-être aussi