5-29
5 Understanding Programming
CJ2 CPU Unit Software User’s Manual
5-2 Tasks
5
5-2-3 Interrupt Tasks
With range comparison, the comparison conditions (upper and lower limits and entering or leaving
the range) are registered in the CTBL(882) comparison table along with the corresponding interrupt
task numbers. The specified interrupt task will be executed when a comparison condition is met.
z Overhead Time for External Interrupt Tasks
For external interrupt tasks, the time until the CPU Unit receives the interrupt signal depends on the
type of Unit or Board (i.e., Special I/O Unit or CJ-series CPU Bus Unit) that requests execution of the
external interrupt task from the CPU Unit and the service type of the interrupt request. For details,
refer to the relevant Unit manual.
The interrupt overhead time after the CPU Unit receives the interrupt signal is the same as for I/O
interrupt tasks.
When an input to a Pulse I/O Module connected to a CJ2M CPU Unit is being used as an interrupt
input, an interrupt task will be executed when the input turns ON or OFF (called Direct Mode) or when
the incremental or decremental counter counts out (called Counter Mode). The interrupt task that is
executed for each input is fixed and cannot be changed (interrupt tasks 140 to 147). The SET INTER-
RUPT MASK instruction (MSKS(690)) is used to enable interrupts and set the operating mode to Direct
Mode or Counter Mode.
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 starting at the lowest task number after execution of the
normal cyclic tasks (cyclic task numbers 0 to 127) has been completed. The maximum number of extra
cyclic tasks is 256 (Interrupt task numbers: 0 to 255).
Precautions for Correct UsePrecautions for Correct Use
Do not use task numbers assigned to extra cyclic tasks for interrupt tasks. An extra cyclic tasks
with the same task number as a power OFF interrupt task, a scheduled interrupt task, or an I/O
interrupt task will be executed both as an extra cyclic task and as an interrupt task.
Note 1 TKON(820) and TKOF(821) can be input and executed in an extra cyclic task, but they will not be executed
when the task is executed as an interrupt task.
2 The differences between normal cyclic tasks and extra cyclic tasks are listed in the following table.
Input Interrupt Tasks (CJ2M CPU Units Only)
Extra Cyclic Tasks
Item Extra cyclic tasks Normal cyclic tasks
Activating at startup Setting is not possible. Set from CX-Programmer
Task Flags Not supported. Supported. (Cyclic task numbers 0
to 127 correspond to Task Flags
TK000 to TK127.)
Initial Task Execution Flag
(A200.15) and Task Start Flag
(A200.14)
Not supported. Supported.
Index (IR) and data (DR) register
values
Not defined when task is started
(same as normal interrupt tasks).
Values at the beginning of each
cycle are undefined. Always set val-
ues before using them. Values set
in the previous cycle cannot be
read.
Undefined at the beginning of oper-
ation. Values set in the previous
cycle can be read.