beautypg.com

Rockwell Automation GMLC Reference Manual User Manual

Page 504

background image

Publication GMLC-5.2 - November 1999

Expression Operators

467

Bitwise NOT

~

Use the tilde to complement all the bits in a binary value. Technically, this
is the 1’s complement of the value. It is particularly useful for inverting
the value of an input or output group used with negative logic devices’.

For example, the following expression complements the defined bits of
the group

Input_Group

.

~Input_Group

Specifically, if

Input_Group

is defined to consist of inputs 2 – 5,

which are currently in the following states, the expression above is
evaluated as 5 (the complement of 1010

2

= 0101

2

= 5

10

):

Input 2 =

OFF

Input 3 =

ON

Input 4 =

OFF

Input 5 =

ON

Bitwise AND

&

Use the ampersand to logically

AND

together the corresponding bits in the

binary representation of the two elements. It is particularly useful for
forcing unwanted bits in an input or output group

OFF

. This is also known

as masking.

!

ATTENTION: Do not use the Bitwise NOT operator
on user or system variables.

!

ATTENTION: Do not use the Bitwise AND operator
on user or system Variables.