Section 7. Installation
7.8.4.15.4 Logical Expressions
Measurements can indicate absence or presence of an event. For example, an RH
measurement of 100% indicates a condensation event such as fog, rain, or dew.
The CR1000 can render the state of the event into binary form for further
processing, so the event is either occurring (true), or the event has not occurred
(false).
True = -1, False = 0
In all cases, the argument
0
is translated as
FALSE
in logical expressions; by
extension, any non-zero number is considered "non-FALSE." However, the
argument
TRUE
is predefined in the CR1000 operating system to only equal
-1
,
so only the argument
-1
is
always
translated as
TRUE
. Consider the expression
If
Condition(1) = TRUE
Then
...
This condition is true only when Condition(1) =
-1
. If Condition(1) is any other
non-zero, the condition will not be found true because the constant
TRUE
is
predefined as
-1
in the CR1000 system memory. By entering
= TRUE
, a literal
comparison is done. So, to be absolutely certain a function is true, it must be set
to
TRUE
or
-1
.
Note
TRUE
is
-1
so that every bit is set high (-1 is &B11111111 for all four
bytes). This allows the
AND
operation to work correctly. The
AND
operation
does an AND boolean function on every bit, so
TRUE AND X
will be non-zero if
at least one of the bits in X is non-zero (if X is not zero). When a variable of data
type BOOLEAN is assigned any non-zero number, the CR1000 internally
converts it to
-1
.
The CR1000 is able to translate the conditions listed in table
Binary Conditions of
TRUE and FALSE
(p. 164)
to binary form (-1 or 0), using the listed instructions and
saving the binary form in the memory location indicated. Table
Logical
Expression Examples
(p. 165)
explains some logical expressions.
Non-Zero = True (Sometimes)
Any argument other than
0
or
-1
will be translated as
TRUE
in some cases and
FALSE
in other cases. While using only
-1
as the numerical representation of
TRUE
is safe, it may not always be the best programming technique. Consider
the expression
If
Condition(1)
then
...
Since
= True
is omitted from the expression,
Condition(1)
is considered true if it
equals any non-zero value.
164
Summary of Contents for CR1000
Page 2: ......
Page 4: ......
Page 6: ......
Page 32: ......
Page 36: ......
Page 38: ......
Page 40: ......
Page 60: ...Section 4 System Quickstart Figure 16 PC200W View Line Graph 60 ...
Page 96: ......
Page 98: ...98 ...
Page 302: ......
Page 453: ...Section 8 Operation Figure 115 Using the Keyboard Display 453 ...
Page 456: ...Section 8 Operation Figure 118 Real Time Custom 456 ...
Page 457: ...Section 8 Operation 8 8 1 3 Final Memory Tables Figure 119 Final Memory Tables 457 ...
Page 458: ...Section 8 Operation 8 8 2 Run Stop Program Figure 120 Run Stop Program 458 ...
Page 460: ...Section 8 Operation Figure 122 File Edit 460 ...
Page 461: ...Section 8 Operation 8 8 4 PCCard Memory Card Display Figure 123 PCCard CF Card Display 461 ...
Page 478: ......
Page 506: ......
Page 536: ......
Page 636: ......
Page 642: ......
Page 644: ......
Page 676: ......
Page 677: ......