5-19
5 Designing Tasks
NJ-series CPU Unit Software User’s Manual (W501)
5-2 Task System
5
5-2-5 Event Task Execution Timing
Execution Timing When the Execution Condition Is a Condition Expression
for a Variable
The condition expression is evaluated for a match inside the primary periodic task. This means that
the event task will be executed immediately after the first execution of the primary periodic task after
the specified value of the variable meets the condition expression. However, if there are tasks with a
higher execution priority than the event task, those tasks will be executed first.
Example 1: Project with a Priority-16 Periodic Task and an Event Task Execution with a Priority of 8
The event task is executed immediately after the first execution of the primary periodic task
after the condition expression is met. The execution priority of the event task (execution priority
of 8) is higher than the execution priority of the priority-16 periodic task. The priority-16 periodic
task is therefore executed after the event task is executed.
Example 2: Project with a Priority-16 Periodic Task and an Event Task Execution with a Priority of 48
The execution priority of the event task is lower than the execution priority of the priority-16
periodic task. The event task is therefore executed after the priority-16 periodic task is
executed.
Task period
Condition
expression
is met.
High
Low
Execution
priority
Priority-16
periodic task
Event task (execution
priority of 8)
Primary periodic
task
Value is assigned
to variable in user
program.
Primary period
MC
IO
UPG
MC
IO
UPG
MC
IO
UPG
MC
IO
UPG
MC
IO
UPG
Interrupted.
Interrupted.
Event task is executed
immediately after the
condition expression is met.
Task period
Condition expression
is met.
High
Low
Execution
priority
Priority-16
periodic task
Event task (execution
priority of 48)
Primary periodic
task
Primary period
Value is assigned
to variable in user
program.
MC
IO
UPG
MC
IO
UPG
MC
IO
UPG
MC
IO
UPG
MC
IO
UPG
Interrupted.
Interrupted.
Event task is executed
immediately after completion
of the periodic task.