Section 8. Processing and Math Instructions
8-2
And Operator
Used to perform a bit-wise conjunction on two numbers.
Syntax
result
=
number1
And
number2
The And operator performs a bit-wise comparison of identically positioned bits in
two numbers and sets the corresponding bit in result according to the following
truth table:
If bit in
And bit in
The result
number1 is
number2 is
is
0 0
0
0 1
0
1 0
0
1 1
1
Although AND is a bit wise operator, it is often used to test Boolean
(True/False) conditions. The CR200 decides if something is true or false on
the criteria that 0 is false and any non-zero number is true (Section 4.5).
Because AND is a bit wise operation it is possible to AND two non-zero
numbers (e.g., 2 and 4) and get 0. The binary representation of –1 has all bits
equal 1. Thus any number AND –1 returns the original number. That is why
the pre defined constant, True = -1.
The predefined constant True = -1
The predefined constant False = 0
If
number1
is:
AND
number2
is:
The
result
is:
-1 Any
number
number2
-1
NAN (not a number)
NAN
0 Any
number 0
0 NAN
NAN
Expressions are evaluated to a number (Section 4.5) and can be used in place
of one or both of the numbers. Comparison expressions evaluate as True (-1)
or False (0) For example:
If Temp(1) > 50 AND Temp(3) < 20 Then
X = True
Else
X = False
EndIf
and
X = Temp(1) > 50 AND Temp(3) < 20
Both have the same effect, X will be set to –1 if Temp(1) is greater than 50 and
Temp(4) is less than 40. X will be set to 0 if either expression is false.
Содержание CR9000
Страница 6: ...CR9000 Table of Contents iv This is a blank page ...
Страница 22: ...CR9000 Overview OV 16 This is a blank page ...
Страница 26: ...Section 1 Installation 1 4 CR9000 FIGURE 1 1 3 CR9000 Battery Pack ...
Страница 72: ...Section 3 CR9000 Measurement Details 3 28 This is a blank page ...
Страница 88: ...Section 5 Program Declarations 5 6 This is a blank page ...
Страница 217: ...This is a blank page ...