Object POU

Symbol: Object POU 1:

An object of type POU is a program organization unit in a TwinCAT PLC project, as defined in the IEC 61131-3 standard.

The following POU types can be added to the PLC project:

In addition, you can add the following programming objects to these objects:

Certain POUs can call other POUs. Recursions are not allowed.

When POUs are called via the namespace, TwinCAT searches the project for the calling POU according to the following order:

  1. Current application
  2. Library manager for the current application

Creating an object POU

1. Select a folder in the Solution Explorer in the PLC project tree.
2. In the context menu select the command Add > POU...
The Add POU dialog opens.
3. Enter a name and select a type and the implementation language.
4. Click on Open.
The POU is added to the PLC project tree and opened in the editor. The editor consists of the declaration editor at the top and the implementation part at the bottom. Depending on the implementation language, the Toolbox view may automatically become active, in which suitable elements, operators and function blocks are provided.

Dialog Add POU

Object POU 2:

Name

Name of the POU

Implementation language

Selection list for the implementation language of the POU

Type

Program

 

Function block

  • Object POU 3: Advanced: Enter or select a predefined function block for object-oriented programming. This is specified with keyword EXTENDS in the function block declaration.
  • Object POU 4: Implemented: Enter or select an interface for object-oriented programming. This is specified with keyword IMPLEMENTS in the function block declaration. When the POU is created, all methods defined via the interface are created.
    See also Automatic creation of interface elements in a function block
  • Object POU 5: Final: Derived access is not allowed. It means that you cannot extend the function block with another function block. This enables you to check whether or not further derivations should be allowed. This enables optimized code generation.
  • Object POU 6: Abstract: Indicates that the function block has a missing or incomplete implementation and cannot be instanced. Abstract function blocks serve exclusively as basic function blocks and the implementation typically takes place in a derived function block. If a non-abstract function block is created, which in turn extends an abstract function block, all methods of the abstract basic function block are added as (non-abstract) methods to the new function block.
    See also ABSTRACT concept
  • Access modifier
    • PUBLIC: Corresponds to the specification of no access modifier
    • INTERNAL: Access to the function block is limited to the namespace (the library).
  • Method implementation language: If you have selected the option Implements, you can use this option to select an implementation language for all method objects, which TwinCAT generates via the implementation of the interface.
    The method implementation language is independent of the implementation language for the function block.

Function

Not available, if the Sequential Function Chart language (SFC) is selected in the selection list for the implementation language.

Return type: Selection list for the data type of the return value