55
Programming with Tasks Section 2-1
Input Interrupts (Direct
Mode and Counter Mode)
An interrupt task can be executed each time one of the built-in inputs on the
CPU Unit turns ON or OFF (Direct Mode) or when a specified number of
inputs has been counted (Count Mode).
Scheduled Interrupt Tasks A scheduled interrupt task will be executed at a fixed interval based on the
internal timer of the CPU Unit. Only one scheduled interrupt tasks can be
used (interrupt task number:2).
High-speed Counter
Interrupts
Pulse inputs to a built-in high-speed counter in the CPU Unit can be counted
to trigger execution of an interrupt.
External Interrupt Tasks
(CP1H CPU Units)
A user-specified interrupt task (interrupt task numbers 0 to 255) can be exe-
cuted when an external interrupt occurs.
The interrupt task will be executed when requested by a user program running
in a CJ-series Special I/O Unit or CJ-series CPU Bus Unit.
Up to 256 external interrupt tasks can be used (interrupt task numbers: 0 to
255). If an external interrupt task has the same number as scheduled, input,
or high-speed counter interrupt task, the interrupt task will be executed for
either condition (the two conditions will operate with OR logic) but basically
task numbers should not be duplicated.
Extra Cyclic Tasks An interrupt tasks can be executed every cycle, just like the normal cyclic
tasks. Extra cyclic tasks (interrupt task numbers 0 to 255) are executed start-
ing at the lowest task number after execution of the normal cyclic task (cyclic
task numbers 0 to 31) has been completed. The maximum number of extra
cyclic tasks is 256 (Interrupt task numbers: 0 to 255). Cycle interrupt tasks,
however, are different from normal cyclic tasks in that they are started with
TKON(820), i.e., they cannot be started automatically at startup.
If an extra cyclic task has the same number as a scheduled, input, or high-
speed counter interrupt task, the interrupt task will be executed for either con-
dition (the two conditions will operate with OR logic). Do not use interrupt
tasks both as normal interrupt tasks and as extra cyclic tasks.
Note (1) Also, TKON(820) and TKOF(821) cannot be used in extra cyclic tasks,
meaning that normal cyclic tasks and other extra cyclic tasks cannot be
controlled from within an extra cyclic task.
(2) The differences between normal cyclic tasks and extra cyclic tasks are
listed in the following table.
CPU Unit model Number of tasks Interrupt task numbers
CP1H X or XA 8 tasks max. 140 to 147
Y 6 tasks max. 140 to 145
CP1L M (30 or 40 I/O points) 6 tasks max. 140 to 145
L (20 I/O points) 6 tasks max. 140 to 145
L (14 I/O points) 4 tasks max. 140 to 143
Item Extra cyclic tasks Normal cyclic tasks
Activating at startup Not supported. Supported. (Set from CX-
Programmer.)
Using TKON(820)
and TKOF(821)
inside task
Not supported. Supported.
Task Flags Not supported. Supported. (Cyclic task
numbers 00 to 31 corre-
spond to Task Flags TK00 to
TK31.)