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

Page 103

Advertising
background image

Programming DH and DH+

Message Procedures

Chapter 6

6-12

Since the leftmost bit of an expression is the sign bit, this means that the
right bit shift on a 32-bit value does not change the sign of the numeric
value. The rightmost bits still shift out of the value and are lost as shown
in the following examples:

GRINDER = (GRINDER >> 1)

GRINDER Value:

Bit Pattern (32Ćbits):

Decimal Value:

Before operation

100...00000101

-2147483643

After operation

110...00000010

-1073741822

$H0:1 = ($H0:1 >> 1)

$H0:1 Value:

Bit Pattern (32Ćbits):

Decimal Value:

Before operation

010...00000101

1073741829

After operation

001...00000010

536870914

Comparison Operators

Comparison operators result in a value of 1 if the comparison is true and 0
(zero) if the comparison is false. For example:

$I12:24 = ($CACC:1.GE.$CACC:2)

If the accumulated value of counter 1

is:

Then the scanner stores this value in

input file 12 word 24:

greater than or equal to the accumulated

value of counter 2

1

less than the accumulated value of

counter 2

0

Advertising