Delta AH500 — 1.2.2 Program Organization Units and Tasks

Chapter 1 Introduction IEC 61131-3 lies in the fact that the large program is divided into several small units. These small units are called POUs. The POUs can be classified into three types. 1. Program (PROG): The POU of the program type plays the role of the primary program in the PLC program. The designer can define the execution of the POU of the program type as the cyclic scan or the interrupt, and arrange the scan order in the task list for the POUs of the program type. 2. Function block (FB): The meaning of the function block (FB) in itself is similar to the subroutine.

The program defined within the function block is executed after the function block is called by the POU of the program type and the related parameters are entered. 3. Function (FC): The meaning of the function (FC) in itself is close to the macro instruction. That is, users can write many operation instructions or functions into the function POU, and then call them into use in the POU of the program type or the function block. The task is a function which stipulates that programs are executed in certain order or according to certain interrupt condition.

The meaning of the task lies in the fact that it provides each POU of the program type with a specific execution task, and specifies the execution order for the POUs of the program type or the way to enable them. Basically, not all of the POUs of the program type in a project will take part in the practical execution. Whether to execute the POU of the program type or not, and how to execute it depend on the assignment of the task. If the POU of the program type is not assigned the task, it will be saved as an ordinary source code with the project instead of being compiled as an execution code of the PLC. In addition, only the POU of the program type needs to be assigned the task.

The execution of the function blocks or functions depends on the superior POU of the program type which calls them. There are three types of tasks. 1. Cyclic task: The POUs of the program type assigned to the cyclic task will be scanned cyclically, and executed in order. 2. Timed interrupt task: If the time of interrupting is reached, all POUs of the program type assigned to the timed interrupt task will be executed in order. 3. Conditional interrupt task: Conditional Interrupts can be divided into several types. For example, the external interrupts, the I/O interrupts, and etc. Users have to make sure of the interrupts supported by the PLC before they create a project.

If the POU of the program type is assigned to the conditional interrupt task, the function of the POU of the program type is similar to the interrupt subroutine. If the interrupt condition is satisfied, e.g. the contact of the external interrupt is triggered, all POUs of the program type assigned to the task will be executed in order. 1-11