Rockwell Automation 57C610 Enhanced Basic Language, AutoMax User Manual

Page 37

Advertising
background image

5Ć5

Table 5.3 Ć Truth Table for Boolean Operators

A

B

A AND B

A OR B

A XOR B

NOT A

0

0

0

0

0

1

0

1

0

1

1

1

1

0

0

1

1

0

1

1

1

1

0

0

1= TRUE; 0 = FALSE

The AND boolean operator has a higher precedence than the OR or

XOR operators, which have equal precedence. Thus, in a boolean

expression, the AND operator will be evaluated before the OR

operator. The NOT operator is always applied immediately to the

expression (which is the same as the unary minus operator). The

following examples show a boolean expression and the order of

evaluation of the operators:

A@ = B@ OR C@ AND D@

1. C@ AND D@
2. B@ OR [C@ AND D@]

A@=B@ AND NOT C@ OR D@ AND A@

1. NOT C@
2. B@ AND [NOT C@]
3. D@ AND A@
4. [B@ AND (NOT C@)] OR [D@ AND A@]

A@ = NOT(A@ OR B@AND C@) OR C@ AND NOT D@ OR

B@

1. B@ AND C@
2. A@ OR [B@ AND C@]
3. NOT [A@ OR (B@ AND C@)]
4. NOT D@
5. C@ AND [NOT D@]
6. [NOT (A@ OR (B@ AND C @))] OR [C@ AND (NOT D@)]
7. [(NOT (A@ OR (B@ AND C@))) OR (C@ AND (NOT D@))] OR

B@

Boolean values can be combined with integer values by using either

boolean or arithmetic operators. In combining the two data types,

note the following guidelines:
D When a boolean value is combined with an integer value using

boolean operators or arithmetic operators, the result is always in

integer.

Advertising
This manual is related to the following products: