02.09.2014 Views

ISPSoft User Manual

ISPSoft User Manual

ISPSoft User Manual

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 5 Program Organization Units and Tasks<br />

The characteristic of the IEC 61131-3 architecture is that a program is divided into several POUs<br />

which can be developed independently. When all POUs are compiled, they are rearranged and<br />

combined into an execution code which can be scanned step by step. The POUs are rearranged<br />

and combined according to the tasks to which the POUs are assigned.<br />

In <strong>ISPSoft</strong>, a POU of the program type is assigned to a task. However, more one POU can be<br />

assigned to the same task, and the order in which these POUs are executed can be specified.<br />

Besides, after users add a POU of the program type, they must assign it to a default task.<br />

There are three types of tasks. They are cyclic tasks, timed interrupt tasks, and conditional interrupt<br />

tasks.<br />

• Cyclic task<br />

A POU assigned to a cyclic task is scanned back and forth. Owning to the fact that there is only<br />

one cyclic task in a project for a DVP series PLC, the POUs which will be scanned cyclically are<br />

assigned to this cyclic task. However, there are 32 cyclic tasks in a project for an AH500 series<br />

CPU module. These cyclic tasks are numbered from 0 to 31. The smaller the task number is, the<br />

earlier the task is executed. Besides, AH500 series CPU modules support the applied<br />

instructions (TKON and TKOFF) which control tasks. <strong>User</strong>s can enable or disable a task during<br />

the operation of an AH500 series CPU module.<br />

A POU is which a sequential function chart can only be assigned to a cyclic task. It can not be<br />

assigned to an interrupt task.<br />

• Timed interrupt task<br />

A POU of the program type which is assigned to a timed interrupt task is like a timed interrupt<br />

subroutine. If the time when timed interrupts should occur is reached, the POUs assigned to the<br />

timed interrupt task will be executed in order. Besides, the number of timed interrupt tasks<br />

depends on a PLC selected. The number of interrupt sources that a PLC supports is the number<br />

of timed interrupt tasks that the system has.<br />

• Conditional interrupt task<br />

There are several types of conditional interrupt tasks. For example, external interrupts, I/O<br />

interrupts, counting interrupts, and etc. Different PLCs provide different conditional interrupt tasks.<br />

<strong>User</strong>s have to make sure of the conditional interrupt tasks which are supported by the PLC before<br />

they assign the POUs of the program type to tasks. A POU of the program type which is assigned<br />

to a conditional interrupt task is like an interrupt subroutine. If the condition of an interrupt is met,<br />

e.g. the value of a counter reaches the setting value, the POUs assigned the interrupt task will be<br />

executed in order.<br />

5.3.2 Tasks in the Project Management Area<br />

The POUs which are assigned to tasks are listed in the Tasks section in the project management<br />

area, and the POUs which are not assigned to tasks are not listed in the Tasks section. The order in<br />

which the POUs listed in a task section are arranged is the order in which the POUs are executed.<br />

Take the project for an AH500 series CPU module below for example. There are 9 POUs of the<br />

program type. The assignment of the POUs of the program type to tasks is as follows.<br />

Task name POU Execution<br />

Not assigned<br />

Prog2 and Prog3<br />

Owning to the fact that Prog2 and Prog3 are<br />

not assigned to tasks, Prog2 and Prog3 are<br />

not executed.<br />

Cyclic (0)<br />

Prog6 and Prog4<br />

The smaller the task number is, the earlier the<br />

task is executed. As a result, the order in<br />

Cyclic (1)<br />

Prog5 and Prog7<br />

which Prog6, Prog4, Prog5, and Prog7 are<br />

scanned is Prog6Prog4Prog5 Prog7.<br />

I/O interrupt (0) Prog1<br />

If the condition of the interrupt is met, Prog1<br />

will be executed once.<br />

Timed interrupt 1 (253) Prog8 and Prog9<br />

Timed interrupt 1 is triggered every specific<br />

period of time. The order in which Pog8 and<br />

Prog9 are executed is Prog8Prog9.<br />

*. The setting of the condition for an interrupt will be introduced in section 5.5. Please refer to instructions for PLCs<br />

for more information.<br />

5-5

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!