Rockwell Automation 1775-S5_SR5,D17756.5.5 User Manual PLC-3 FAMILY I/0 User Manual

Page 100

Advertising
background image

Programming DH and DH+

Message Procedures

Chapter 6

6-9

Bit Operator

The bit operator allows you to address a specific bit of a value stored under
a user symbol. For example:

$l12:24/7 = US_13/4

This statement puts the value (0 or 1) of bit number 4 of user symbol
US_13 into input file 12, word 24, bit 7.

The bit address itself can also be a user symbol or an expression. For
example:

$l12:24/7 = US_3/(4+US_1)

The expression (4+US_1) specifies a particular bit within user symbol
US_3.

The value appearing after the bit operator must be within the range of
values allowed for bit addresses. Since user symbols are 32-bit values, a
bit address for a user symbol must be in the range of 0 to 31 (decimal). Bit
addresses for data table words must fall in the range of 0 to 15 (decimal).

Logical Operators

The logical operations are NOT, AND, and OR. These operations
construct logically true or false conditions. You generally use them in
decision statements such as the IF command.

The result of a logical complement is 1 (true) if the expression following
the .NOT. is a value of 0. Otherwise, the result is 0 (false).

For example:

$l12:24 = .NOT.SYMBOL_A

If SYMBOL_A is:

Then the scanner stores this value in input file 12 word 24:

0

1

not 0

0

The result of a logical AND is 1 (true) if the expression preceding the
.AND. and the expression following the .AND. are both non-zero.
Otherwise, the result is 0 (false).

The result of logical OR is 1 (true) if either the expression preceding the
.OR. is non-zero, the expression following the .OR. is non-zero, or both
expressions are non-zero. Otherwise, the result is 0 (false).

Advertising