Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
SYPT PRO User Guide / SYPT PRO User Guide.doc
Скачиваний:
244
Добавлен:
03.03.2016
Размер:
17.32 Mб
Скачать

Inserting Sections

DPL programs are made up of a list of sections, containing DPL text, diagrams, descriptions, alias definitions and variables. A number of different types of sections can be inserted when offline in the DPL Editor.

  • Tasks

  • User-defined Function Blocks

  • Subroutines

  • Notes (comments)

  • Alias sections

Text (with the exception of Comments) should not be entered 'outside' a section.

To insert a task section

1. Place the cursor at the required insertion point, outside any other sections.

2. From the Insert menu, choose Task / Section.

The Insert Task dialog box is displayed.

3. Select the required task type.

4. Click OK.

The chosen task section is inserted into the DPL program text at the current cursor position.

Alternatively, right-click a section node in the DPL Editor Workspace and choose Insert Task/ Section to insert a task prior to the selected node. The following shows the Background task node selected in the Workspace:

Note:

You must insert task sections into DPL programs using the appropriate menu items. Task section delimiters (task header and 'end-of-section' markers) typed directly by the user will not be recognized by the compiler.

To insert a user-defined function block (UDFB)

1. Place the cursor at the required insertion point. The insertion point must be outside of any other sections and before the code location where the UDFB will be used, usually at the top of the program.

2. From the Insert menu, choose User Defined Function Block.

The Function Block dialog is displayed:

3. In the FB Name field, enter in the UDFB name making sure to prefix the name with the underscore character (_).

4. Define the UDFB's input and outputs arguments:

a) In the Inputs section, click on the '...' item in the list.

b) In the Name and Type fields, enter the name and data type of each argument.

c) In the Outputs section, repeat steps a and b.

5. Press OK.

The new UDFB section is inserted in the DPL program.

Alternatively, right-click a section node in the DPL editor tree view and choose Insert User Defined Function Block to insert a UDFB prior to the selected node.

To edit an existing user-defined function block

1. Double-click the UDFB declaration header.

The Function Block dialog appears displaying the UDFB's definition:

2. Make the necessary changes, then click OK.

In the following example the line highlighted in grey is the UDFB header for the _MyFB UDFB.

Subroutines

Subroutines are inserted in a similar way to task sections using the Insert Task menu command.

To insert a subroutine

1. Place the cursor at the required insertion point. This insertion point must be outside of any other sections.

2. From the Insert menu, choose Insert Task / Section.

3. In the Task text box, type the name of the subroutine.

The DPL Language requires that you place a colon `:' after a subroutine name. For example, "MyTask:" is a valid subroutine name.

Note:

The use of user-defined function blocks rather than subroutines is recommended. UDFBs provide better encapsulation of data and also allow the creation of multiple instances of blocks.

Note Sections and Comments

Note sections can be used to write a text description of the purpose or function of a program.

To insert a notes section

  • From the Insert menu, choose Notes.

Alternatively, right-click a section node in the DPL editor tree view and choose Insert Notes to insert a Notes section prior to the selected node.

You can also insert comment lines anywhere in a node DPL program text. Comments are free-format text descriptions which are prefixed with a double-slash (//) or a semi-colon (;):

// This is a comment line.

; Type any comment text here.

List of Aliases Section

Aliases are defined either in a List of Aliases section or by entering them directly into the DPL text. Alias sections are best located at the top of a DPL program so that any definitions apply to the whole of the program.

To insert a List of Aliases section

1. Place the cursor at the required insertion point.

2. From the Insert menu, choose Alias.

Alternatively, right-click a section node in the DPL editor tree view and choose Insert Alias to insert a List of Aliases section prior to the selected node.

See Also

  • Editing Programs

  • Program Structure

  • Tasks

  • Subroutines

  • User-Defined Function Blocks (UDFBs)

________________________________________________________________________________