How to program a DFB type

To program a DFB type you must:

  • create the DFB section(s),

  • enter the program code for each section.

Creating a section

Carry out the following actions in order to create a DFB section:

Step

Action

1

Go to the DFB types tab of the data editor.

Result: the list of existing DFBs is displayed on the screen.

2

Expand the DFB type that you would like to program.

3

Expand the sections directory by clicking on +.

4

Select the Name cell and enter the name of the section.

Confirm with Enter.

Result: a dialog box is displayed on the screen to allow you to create a new section.

5

Select the programming language desired in the drop-down menu in the Language field.

6

Click OK to confirm the command.

Result: the section appears in the sections directory.

7

If the sections directory already contains sections and you want to create a new one, expand the directory and select the first empty Name cell.

Result: the dialog box used to enter section parameters is displayed on the screen.

8

Enter the section parameters and confirm with OK.

Result: the new section appears in the sections directory.

Entering the program

Carry out the following actions in order to enter the program for the section:

Step

Action

1

Expand the sections directory of the DFB whose code you would like to enter.

Result: the list of sections is displayed on the screen.

2

Right-click on the name of the section to program.

Result: the contextual menu appears.

3

Activate the Open command.

Result: the section programming screen is displayed on the screen, in the selected language.

4

Enter the section program.

Programming restrictions

All language instructions are allowed, except instructions that use input/output module variables (READ_STS, READ_PARAM, WRITE_CMD, etc..).

Connection to a label (JUMP) is only possible within the same section.

You may not use the following objects:

  • input/output objects (%I, %Q, etc.),

  • the application's global objects (%MW, %KW, ...), except system bits and words %S and %SW.

NOTE: When the Create variable option in the contextual menu is used from a DFB section, the variable created is a private variable.
NOTE: For PL7 Function blocks (Obsolete Library): it is recommended not to use the PL7_••• function blocks inside DFBs because you are not allowed to create new instances in online mode.