Object ‘POU’

Symbol:

An object of the type POU is a Program Organization Unit in a CODESYS project. You write source code for your controller program in POUs.

There are the following types of POUs:

A POU object is inserted by using the command Project ‣ Add Object in the Device tree or in the POUs view. When adding a POU you define 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 via the namespace, CODESYS browses the project for the POU to be called in accordance with the following order:

  1. Current application

  2. Library Manager of the current application

  3. POUs view

  4. Library Manager in the POUs view

Note

If you want to call a POU that exists with the same name in a library used in the application and as an object in the POUs view, note the following: There is no syntax that allows you to call the POU in the POUs view only by its name. In this case you must shift the library from the application’s library manager to the project’s library manager (in the POUs view). After that you can call the POU object in the POUs view purely by its name. If you add the namespace to the library, you can call the POU of the library.

Note

The term “POU” is also used in CODESYS for the POUs view in which CODESYS manages the global objects in the project.

See also

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: Menu bar: Project ‣ Add Object ; context menu in the Devices view when an application is selected; context menu in the POUs view

Name Name of POU
Type
Program  
Function Block
  • Extends: Specification or selection of a base function module in the sense of object-oriented programming. Specified with the EXTENDS keyword in the function block declaration.

  • Implements: Specification or selection of an interface in the sense of object-oriented programming. Specified with the IMPLEMENTS keyword in the function block declaration.

  • 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.

  • 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.

  • Access specifier

    • PUBLIC: Corresponds to the specification of no access modifier
    • 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

See also