Skip to main content

Object: POU

Symbol: _cds_icon_pou.png

An object of type POU is a "programming organization unit" in a CODESYS project. Source code for your controller program is written in POUs.

There are following POU types:

You add a POU in the device tree or in the POUs view by means of the Project → Add Object command. When adding a POU, you specify the POU type and the implementation language.

You can also add other programming objects (method, action, etc.) to these objects.

Calling POUs

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

When calling POUs by means of the namespace, CODESYS scans the project for the POU to be called by the following order:

  1. Current application

  2. Library Manager of the current application

  3. POUs view

  4. Library Manager in the POUs view

Tip

If you want to call a POU which exists with the same name in a library used in the application and as an object in the POUs view, then the following applies: There is no syntax that allows you to call the POU in the POUs view only by its name. In this case, you have to move the library from the Library Manager of the application to the Library Manager of the project (in the POUs view). After that, you can call the POU object in the POUs view simply by its name. When you add the namespace to the library, you can call the POU of the library.

Tip

The term "POU" is also used in CODESYS for the POUs view where CODESYS manages the objects which are valid throughout the project.

Dialog: Add POU

Function: The dialog is used to configure a new POU according to the IEC 61131-3 standard. This means that a POU can be a program, a function, or a function block.

Call: Project → Add Object menu; context menu in the Devices view (when an application is selected); context menu in the POUs view

Name

Name of the POU

Table 57. Type

Program

Function block

  • _cds_icon_checked.png Extends: Specification or selection of a base function module based on the idea of object-oriented programming

    Specified with the EXTENDS keyword in the function block declaration

  • _cds_icon_checked.png Implements: Specification or selection of an interface based on the idea of object-oriented programming

    Specified with the IMPLEMENTS keyword in the function block declaration

    When the POU is created, all methods are created which are defined via the interface.

  • _cds_icon_checked.png Final: Derived access is not permitted. This means that you cannot extend the function block with another function block. This allows for optimized code generation.

  • _cds_icon_checked.png Abstract: Identifies that the function block has a missing or incomplete implementation and cannot be instantiated

    Abstract FBs are used exclusively as base function blocks and the implementation typically occurs in a derived FB. If a non-abstract function block is created, which in turn extends an abstract function block, then all abstract methods of the abstract basic function block are added to the new function block as (non-abstract) methods.

  • Access specifier

    • PUBLIC: Corresponds to the specification of no access specifier

    • INTERNAL: Access to the function block is restricted to the namespace (library).

  • Method implementation language: When you select the Implements option, you can select an implementation language here for all method objects that CODESYS generates by means of the implementation of the interface.

    The Method implementation language does not depend on the implementation language of the function block.

Function

Note: Not available when Sequential Function Chart (SFC) is selected as the Implementation language.

Return type:: Data type of the return value

Implementation language

Implementation language of the POU