-

Program POUs in PLCnext Engineer

This topic contains the following sections:

General information on program POUs

A program POU usually contains a logical combination of function/function block calls. Programs have an internal memory. Programs cannot be called from other POUs. A program must be instantiated in a task in order to be executed. Programs that are not instantiated in any task are not executed when running the controller application.

To add a program POU, right-click the folder 'COMPONENTS | Programming > Local > Programs' (or any subfolder) and select the context-menu command 'Add Program'.

The only safety-related program that can be executed by the Safety PLC is the 'S_Main' program (see following section "Program instances") which is marked by the  safety overlay icon:
. It is, however, possible to add further safety-related program POUs while you are logged on to the Safety-related Area. Note that any other program than S_Main will not be executed.

Program instances

A program is only executed if it is instantiated. The instantiation of a non-safety-related program must be done by assigning it to a task in the 'Tasks and Events' editor. To open the 'Tasks and Events' editor, double-click the 'PLCnext' node in the PLANT.

For the Safety PLC, the safety program instance S_Main is predefined and unchangeable: The Safety PLC executes exactly one task in which exactly one program is instantiated. Both the safety-related task and the program instance are created automatically on insertion of a controller with a Safety PLC in the PLANT. The program instance can neither be deleted nor edited and only a few properties of the task can be modified. Refer to the topic "Safety PLC Runtime Configuration" for details.

Further Info
The illustration in the topic "Instantiation: Program and FB Instances" explains the relation between types and instances and shows where instances of these types are possible.