beautypg.com

Precautions, 2 instructions – Omron SYSMAC CP CP1E-N@@D@-@ User Manual

Page 328

background image

2 Instructions

2-292

CP1E CPU Unit Instructions Reference Manual(W483)

Precautions

The subroutine number must be unique

for each subroutine. You cannot use the
same number for more than one sub-
routine.

Each subroutine must have a unique

subroutine number. Do not use the
same subroutine number for more than
one subroutine.

Observe the following precautions

when using differentiated instructions
(DIFU(013), DIFD(014), or up/down dif-
ferentiated instructions) in subroutines.

The operation of differentiated

instructions in a subroutine is unpre-
dictable if a subroutine is executed
more than once in the same cycle.
In the following example, subroutine
1 is executed when CIO 0.00 is ON
and CIO 1.00 is turned ON by
DIFU(013) when CIO 0.01 has
gone from OFF to ON. If CIO 0.01
is ON in the same cycle, subroutine
1 will be executed again but this
time DIFU(013) will turn CIO 1.00
OFF without checking the status of
CIO 0.01.

In contrast, a differentiated instruc-

tion (UP, DOWN, DIFU(013) or
DIFD(014)) would maintain the ON
status if the instruction was exe-
cuted and the output was turned ON
but the same subroutine was not
called a second time.

In the following example, subroutine

1 is executed if CIO 0.00 is ON.
Output CIO 1.00 is turned ON by
DIFU(013) when CIO 0.01 has
gone from OFF to ON. If CIO 0.00
is OFF in the following cycle, sub-
routine 1 will not be executed again
and output CIO 1.00 will remain ON

SBS(091) will be treated as

NOP(000) when it is within a pro-
gram section interlocked by IL(002)
and ILC(003).

SBS

1

Subroutine
1

0.00

SBS

1

0.01

SBN

1

DIFU

1.00

0.01

RET

1

3

5

4

2

The subroutine
is executed
again.

SBS

1

0.00

SBN

1

DIFU

1.00

0.01

RET

1

3

The subroutine is
not executed in
following cycles.

2

This manual is related to the following products: