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:
Current application
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
Name
Name of the POU
Implementation language
Selection list for the implementation language of the POU
Type
Program
Function block
Advanced: Enter or select a predefined function block for object-oriented programming. This is specified with keyword EXTENDS in the function block declaration.
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
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.
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