beautypg.com

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

Page 143

background image

2-107

2 Instructions

CP1E CPU Unit Instructions Reference Manual(W483)

Co

mp

ari
s

on I

n

stru

ctio

ns

2

ZCP/ZCPL

Do not program another instruction between ZCP(088)/ZCPL(116) and the instruction controlled by

the Arithmetic Flag because the other instruction might change the status of the Arithmetic Flag.

Sample program

When CIO 0.00 is ON in the following example, the 16-bit unsigned binary data in D0 is compared to

the range 0005 to 001F hex (5 to 31 decimal) and the result is output to the Arithmetic Flags.
CIO 20.00 is turned ON if 0005 hex

≤ content of D0 ≤ 001F hex.

CIO 20.01 is turned ON if the content of D0 > 001F hex.
CIO 20.02 is turned ON if the content of D0 < 0005 hex.

In this case, the results of instruction B
might change the results of ZCP(088)/ZCPL(116).

A

ZCPL

CD

LL

UL

Arithmetic Flag
(Example: Equal Flag)

Instruction B

20.00

0.00

>

20.01

=

20.02

<

ZCP

D0

#0005

#001F

CD

LL

UL

Arithmetic Flags

≤ 001FHex

D0

LL

CD

UL

= ON(1)

D0

> ON(1)

D0

< ON(1)

> 001FHex

0005Hex

0005Hex >

This manual is related to the following products: