beautypg.com

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

Page 195

background image

2-159

2 Instructions

CP1E CPU Unit Instructions Reference Manual(W483)

Sym

bol

Math I

n

stru

ctio

ns

2

+/+

L

Flags

Function

+

+(400) adds the binary values in Au and Ad and outputs the result to R.

+L

+L(401) adds the binary values in Au and Au+1 and Ad and Ad+1 and outputs the result to R.

Sample program

Name

Label

Operation

+

+L

Error Flag

P_ER

OFF

OFF

Equals Flag

P_EQ

ON when the result is 0.

OFF in all other cases.

ON when the result is 0.

OFF in all other cases.

Carry Flag

P_CY

ON when the addition results in a carry.

OFF in all other cases.

ON when the addition results in a carry.

OFF in all other cases.

Overflow Flag

P_OF

ON when the result of adding two positive num-

bers is in the range 8000 to FFFF hex.

OFF in all other cases.

ON when the result of adding two positive num-

bers is in the range 80000000 to FFFFFFFF hex.

OFF in all other cases.

Underflow Flag

P_UF

ON when the result of adding two negative num-

bers is in the range 0000 to 7FFF hex.

OFF in all other cases.

ON when the result of adding two negative num-

bers is in the range 00000000 to 7FFFFFFF hex.

OFF in all other cases.

Negative Flag

P_N

ON when the leftmost bit of the result is 1.

OFF in all other cases.

ON when the leftmost bit of the result is 1.

OFF in all other cases.

+

CY

R

Au

Ad

(Signed binary)

(Signed binary)

(Signed binary)

CY will turn ON
when there is a
carry.

+

CY

R+1

R

Au+1

Ad+1

Au

Ad

(Signed binary)

(Signed binary)

(Signed binary)

CY will turn ON
when there is a
carry.

+

0.00

+L

D100

D110

D120

0.00

When CIO 0.00 is ON in this example, D100 and D110 will be
added as 4-digit signed binary values and the result will be output
to D120.

When CIO 0.00 is ON, D101 and D100 and D111 and D110 will
be added as 8-digit signed binary values and the result will be
output to D121 and D120.

D100

D110

D120

This manual is related to the following products: