beautypg.com

Syntax, Or operator – Campbell Scientific CR9000X Measurement and Control System User Manual

Page 312

background image

Section 8. Processing and Math Instructions

NOT

The NOT function is used to perform a bit-wise negation on a number.

Syntax
result = NOT (number)

The NOT operator inverts the bit values of any variable and sets the
corresponding bit in result according to the following truth table:

If bit is

The result is

0 1

1 0

Although NOT is a bit wise operator, it is often used to test Boolean
(True/False) conditions. The CR9000X decides if something is true or false on
the criteria that 0 is false and any non-zero number is true (Section 4.2.11.4).
Because NOT is a bit wise operation, the only non-zero number that NOT can
operate on and return 0 is –1. The binary representation of –1 has all bits equal
1. That is why the pre defined constant, True = -1.

The predefined constant True = -1
The predefined constant False = 0

NOT (-1) = 0
NOT (0) = -1
NOT (NAN) = NAN

(NAN= Not A Number)

OR Operator

The OR operator is used to perform a logical disjunction on two numbers.

Syntax
result = number1

OR

number2


The OR operator performs a bit-wise comparison of identically positioned bits in
two numeric expressions and sets the corresponding bit in result according to the
following truth table:

If bit in

And bit in

The result

expr1 is

expr2 is

is

0

0

0

0

1

1

1

0

1

1

1

1


Although OR is a bit wise operator, it is often used to test Boolean (True/False)
conditions. The CR9000X decides if something is true or false on the criteria
that 0 is false and any non-zero number is true (Section 4.2.11.4). In the
CR9000X, the predefined constant False = 0, and the pre-defined constant
True = -1.The binary representation of –1 has all bits equal 1. Thus any number
OR -1 returns -1. Any number AND -1 returns the original number.

8-26