Programming Example - Omron CJ2 CPU - REV 10-2010 User Manual

Cj2 cpu unit software
Table of Contents

Advertisement

10 CPU Unit Functions

Programming Example 1

Programming without Background Execution
As shown below, processing is completed when the instruction is executed.
Execution condition
a
Programming with Background Execution
With background execution, the program is changed so that MAX(182) is executed only when the
specified Communications Port Enabled Flag is ON (i.e., only when the port is not already being
used for background execution or network communications). Also, input conditions are controlled
with SET and RSET instructions to ensure that processing is performed in the correct order. (Com-
munications port 0 is used for background execution in the following example.)
Execution
Communications
condition
Port Enabled Flag
a
A202.00
Communications
Execution
Port Enabled Flag
condition
b
A202.00
Execution
condition
A202.00
c
10-16
MAX
MAX(182) is executed completely
as soon as the execution condition
D0
"a" turns ON.
D100
D200
SUM
SUM(184) can be executed
D2
immediately after MAX(182).
D100
D201
MAX(182) execution is started if
MAX
execution condition "a" is ON and
D0
the Communications Port Enabled
D100
Flag is ON.
D200
Execution condition "b" is turned
SET
ON to enable the next
b
background instructions (here,
SUM(184)).
"a" is turned OFF so that MAX
RSET
(182) will not be executed in the
a
next cycle.
SUM(184) execution is started if
SUM
execution condition "b" is ON and
D2
the Communications Port Enabled
D100
Flag is ON (i.e., when MAX(182)
D201
execution has been completed).
"b" is turned OFF so that SUM(184)
RSET
will not be executed in the next
b
cycle.
Execution of SUM(184) has been
SET
completed when "c" is ON and the
c
Communications Port Enabled Flag
is ON.
"c" is turned ON to enable
Confirmation of
confirming the completion of SUM
completion of
background
(184).
execution
CJ2 CPU Unit Software User's Manual

Advertisement

Table of Contents
loading

Table of Contents