Programs (POU)
With the basic building blocks, a program can be seen as a network of functions and function blocks. Each of them being written in any of the defined Programming Languages.
-
-
Programs and Subprograms can be reordered by drag-and-drop.
Dragging an item up the list places it above the program you drop it on, while dragging down places it below.
Sub-programs
The list of programs is completed with Sub-programs.
- Sub-programs are written in FBD, FFLD, IL Language, or ST Language.
- They are called by the programs of the application.
- Input and output parameters plus local variables of a sub-program are declared in the variable editor as local variables of the sub-program.
- A function type sub-program can call another function type subprogram.
- A UDFB type sub-program can call another UDFB-type subprogram or a function type subprogram.
Unlike UDFB, local variables of a sub-program are not instantiated.
- This means that the sub-program always works on the same set of local variables.
- Local variables of a sub-program keep their value among various calls.
- The code of a sub-program is not duplicated when called several times by parent programs.
- A sub-program cannot have more than 32 input parameters or 32 output parameters.
- A good programming practice is to break up your programs into smaller modules.
- See Application Software Structure - Definitions.
Program Guidelines
An application is a list of programs. Programs are executed sequentially within the target cycle, according to this model:
Begin cycle | exchange I/Os | execute first program | ... | execute last program | wait for cycle time to be elapsed End Cycle
Programs are executed according to the order defined by the user.
- All SFC programs must be grouped (it is not possible to insert a program in FBD, FFLD, IL Language, or ST Language between two SFC programs).
- Each program is entered using a language chosen when the program is created.
- Possible languages are:
- Free Form Ladder Diagram (FFLD)
- Function Block Diagram (FBD)
- Instruction List (IL Language).
- Sequential Function Chart (SFC)
- Structured Text (ST Language)
- The maximum number of programs in an application is 32767.
Program Name
Programs must have unique names.
- A program name cannot:
- Be a reserved keyword of the programming languages.
- Have the same name as a standard or "C" Function or function block.
- Have the same name as a declared variable.
- The name of a program must begin by a letter or an underscore ("_") mark, followed by letters, digits or underscore marks.
- It is not allowed to put two consecutive underscores within a name.
- Naming is case-insensitive.
- Two names with different cases are considered as the same.
Child SFC Programs
- You can define an hierarchy of SFC programs, entered as a tree in the list of programs.
- A child program is controlled within action blocks of the parent SFC program.
-
-
- If you do not want to split your FFLD program, separate FFLD from SFC.
- Make a sub-program in FFLD called from the SFC step.
- Keep only the state machine in the SFC program.
- This makes it simpler for editing and debugging.
- If you do not want to split your FFLD program, separate FFLD from SFC.
Program Limitations
When creating your application you have to consider these important limitations.
FFLD Programs
- Width of any network is limited to 255 columns.
- Height of any network is limited to 255 rows.
Other Programs
For any program, sub-program or UDFB written in other languages:
- Jump limit is 64KB.
- Example: In an FFLD program, if you create a UDFB or program which is over 64KB and then add a jump to label in the first network to the last network, this jump reaches the limit.
- Total PLC code size of the program, sub-program or UDFB cannot exceed 64KB.
-
-
- If the PLC code size of the program exceeds 64KB, split the logic into smaller chunks using Action Blocks (POU).
- Acton Blocks function similarly to subprograms but share the parent program’s variables and execution context.
SFC Programs
- Actions in SFC steps cannot be more than 32KB.
- Condition in SFC transition cannot exceed 32KB.
- Total PLC code size of the program cannot exceed 64KB.





