Rockwell Automation 1775-KA PLC-3 Communication Adapter Module User Manual User Manual

Page 70

Advertising
background image

Addressing Rules and Examples

Chapter 4

4Ć14

Operator

Order of

Execution

Operation

.LT.

Compare less than

8

.LE.

Compare less or equal

8

.NE.

Compare not equal

8

.AND.

Logical AND

9

.OR.

Logical OR

10

The result of an expression depends on the order in which the operators
are executed. The order of execution depends on the type of operator and
on left– to–right placement within the expression. Table 4.B gives the
order of execution for the different operators. For example, the command

$B67:45 = 6+3*2

would store the value 12 in word 45 of binary file 67. This is because
multiplication is performed before addition.

If an expression contains several operators with the same order of
execution, those operators will be executed in the left–to–right order in
which they appear within the expression. Extra set of parentheses can be
nested within each other to change the order of execution. In such cases,
the expression within the inner–most set of parentheses is evaluated first.
For example, the command

$B67:45=36%((6+3)*2)

would store the value 2 in word 45 of binary file 67 (% is the operator for
division).

Expressions can be used anywhere that direct numeric values can be used
within a message procedure, including within an address field. For
example, in the statement

$B67:(WORD+3)=5

the expression (WORD+3) specifies the address of a word within binary
file 67. Note that the parentheses are necessary to indicate that +3 is part
of the word address in this case.

Advertising