5-19
5 Understanding Programming
CJ2 CPU Unit Software User’s Manual
5-2 Tasks
5
5-2-2 Cyclic Tasks
• I/O memory other than Index Registers (IR) and Data Registers (DR) is shared by the tasks. For
example, bit CIO 10.00 used in cyclic task 1 and bit CIO 10.00 used in cyclic task 2 refer to the same
bit in memory. If I/O memory other than Index Registers (IR) and Data Registers (DR) accessed by
more than one task, be sure to use sufficient caution when a value changed in one task is used in
another task.
• There are two different ways to use Index Registers (IR) and Data Registers (DR): 1) Independently
by task or 2) Shared by all task.
• With independent registers, IR0 used by cyclic task 1 for example is different from IR0 used by
cyclic task 2.
• With shared registers, IR0 used by cyclic task 1 for example is the same as IR0 used by cyclic
task 2.
The setting that determines if registers are independent or shared is made from the CX-Programmer.
*1 The current EM bank is also shared by tasks. Therefore if the current EM bank number is changed with cyclic
task 1 for example, the new current EM bank number will be valid for cyclic task 2 as well.
*2 IR and DR values are not set when interrupt tasks are started. If IR and DR are used in an interrupt task, these
values must be set by the MOVR/MOVRW (MOVE TO REGISTER and MOVE TIMER/COUNTER PV TO REG-
ISTER) instructions within the interrupt task. After the interrupt task has been executed, IR and DR will return
to their values prior to the interrupt automatically.
Relationship of Tasks to I/O Memory
I/O memory Relationship to tasks
CIO, Auxiliary, Data Memory and all other memory areas except the IR and DR
Areas.
*1
Shared with other tasks.
Index registers (IR) and data registers (DR)
*2
Used separately for each
task.