Overview of the Program Unit
Program Units are autonomous programming entities (only available for Modicon M580 and M340).
The Program Unit includes:
Public and local variables
Sections
The following programming languages are supported:
FBD (Function Block Diagram)
LD (Ladder Diagram Language)
SFC (Sequential Function Chart) only for sections in Program Unit which belongs to the MAST task
IL (Instruction List)
ST (Structured Text)
Animation tables
The Program Units are linked to a task. The same Program Unit cannot belong simultaneously to several tasks.
The sections and Program Units under a task are executed in the order of their programming in the browser window (structure view).
The sections under a Program Unit are executed in the order of their programming in the browser window (structure view).
The identification tags of the instruction lines, the contact networks, and so on, are specific to each section of the Program Unit (no program jump to another section of the same Program Unit is possible).
An execution condition can be associated with one or more Program Units and or sections of Program Units.
Example
The following diagram shows a task structured into Program Units and sections:

The execution order in this MAST
task example, starts with ProgramUnit1
, continues with Section1
and ends
with ProgramUnit2
. Inside ProgramUnit2
the execution order is first Section1_P2
then Section2_P1
.
Characteristics of a Program Unit
The following table describes the characteristics of a Program Unit:
Characteristic |
Description |
---|---|
Name |
32 characters maximum (accents are possible, but spaces are not allowed). |
Section Language |
LD, FBD, IL, ST or SFC |
Task or processing |
Master, fast, auxiliary |
Condition (optional) |
A BOOL or EBOOL type bit variable can be used to condition the execution of the Program Unit. |
Comment |
256 characters maximum |
Protection |
Write-protection, read/write protection. |