5-31
5 Understanding Programming
CJ2 CPU Unit Software User’s Manual
5-2 Tasks
5
5-2-4 Designing Tasks
• Use one task to start and stop other tasks and thus control the overall user program.
Good Example: Define a master-slave relationship between tasks.
Bad Example: Control is difficult if starting and stopping tasks is performed in a disorganized man-
ner.
• Allocate lower numbers to high-priority interrupt tasks.
• A task in READY status will be executed in subsequent cycles as long as the task itself or another
task does not change it to STANDBY status. Be sure to insert a TKOF(821) (TASK OFF) instruction
for other tasks if processing is to be branched between tasks.
• Use the Initial Task Execution Flag (A200.15) or the Task Start Flag (A200.14) in the execution condi-
tion to execution instructions to initialize tasks. The Initial Task Execution Flag will be ON during the
first execution of each task. The Task Start Flag each time a task enters READY status.
Used by All Tasks
Task 0
Task 1
Task 2
Not used
Task 0
Task 1
Task 2
Not used
Used by all tasks.
Used by all tasks.
Task 0 Task 1 Task 2
DM Area
Work Area
D0 to D19999
W0.0 to W199.15
D20000 to D24999
W200.0 to W299.15
D25000 to D29999
W300.0 to W399.15
D30000 to D31999
W400.0 to W499.15
W0.0 to W199.15
W200.0 to W299.15
W300.0 to W399.15
W400.0 to W499.15
W500.0 to W511.15
D0 to D19999
D20000 to D24999
D25000 to D29999
D30000 to D31999
D32000 to D32767
Task
management
(master)
Task 1 (slave)
Task 2 (slave)
Task 3 (slave)
Task 0
Task 2
Task 1
Task 3