D-14, Logical instructions – Rockwell Automation 1785-Lxxx Enhanced and Ethernet PLC-5 Programmable Controllers User Manual

Page 314

Advertising
background image

Publication 1785-UM012D-EN-P - July 2005

D-14 Instruction Set Quick Reference

Logical Instructions

Instruction

Description

AND

NOT Operation

OR

Exclusive OR
XOR

AND

BITWISE AND

Source A

Source B

Dest

D9:3

D9:4

D9:5

3F37

00FF

0037

When the input conditions are true, the controller performs an
AND operation (bit-by-bit) between Source A (D9:3) and Sourc
B (D9:4) and stores the result in the Destination (D9:5). The
truth table for an AND operation is:

Source ASource BResult
000
100
010
111

NOT

NOT

Source A

Dest

D9:3

D9:5

00FF

FF00

When the input conditions are true, the controller performs a
NOT (takes the opposite of) operation (bit-by-bit) on the Sourc
(D9:3) and stores the result in the Destination (D9:5). The trut
table for a NOT operation is:

SourceDestination
01
10

OR

BITWISE INCLUSIVE OR

Source A

Source B

Dest

D9:3

D9:4

D9:5

3F37

00FF

3FFF

When the input conditions are true, the controller performs an
OR operation (bit-by-bit) between Source A (D9:3) and Source
(D9:4) and stores the result in the Destination (D9:5). The trut
table for an OR operation is:

Source ASource BResult
000
101
011
111

XOR

BITWISE EXCLUSIVE OR

Source A

Source B

Dest

D9:4

D9:5

3F37

3F37

0000

D9:3

When the input conditions are true, the controller performs an
exclusive OR operation (bit-by-bit) between Source A (D9:3) an
Source B (D9:4) and stores the result in the Destination (D9:5)
The truth table for an XOR operation is:

Source ASource BResult
000
101
011
110

Status

Bit

Descriptio

C

V

Z

S

always

always

sets if the result is zero; otherwise

sets if the most significant bit (bit 15 for decimal or bit 17 for
octal) is set (1); otherwise resets

Advertising