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

‘Add POU’ dialog

Function: This dialog box serves the configuration of a new POU compliant with the IEC 61131-3 standard. This means that a POU can be a program, a function or a function block.

Call: Menu Project ‣ Add Object , context menu in Devices view; if an application is selected, context menu in POUs view.

Name Name of the POU
Type
Program  
Function block
  • Extended: specification or selection of a basic function block in the sense of object-oriented programming. Specified in the function block declaration with the keyword EXTENDS.

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

  • Access specifier

    • PUBLIC: Corresponds to the specification of no access modifier
    • INTERNAL: Access to the function block is limited to the namespace (the library).
    • FINAL: Derived access is not permitted. This means that you cannot extend the function block by another function block. This enables optimized generation of code.
  • Method implementation language: If you have selected the Implemented option, you can select an implementation language here for all method objects that CODESYS creates via the implementation of the interface.

    The method implementation language is independent of the implementation language of the function block.

Function

Please note: not available if the language Sequential Function Chart (SFC) is selected in the Implementation language selection list.

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

Implementation language Selection list for the implementation language of the POU

See also