Campbell Scientific CR800 and CR850 Measurement and Control Systems User Manual
Page 146

Section 7. Installation
146
The CR800 is able to translate the conditions listed in table Binary Conditions of
TRUE and FALSE
(p. 146)
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. 147)
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.
Table 19. Binary Conditions of TRUE and FALSE
Condition
CRBasic Instruction(s)
Used
Memory Location of Binary
Result
Time
TimeIntoInterval()
Variable, System
IfTime()
Variable, System
Control Port Trigger
WaitDigTrig()
System
Communications
VoiceBeg()
System
ComPortIsActive()
Variable
PPPClose()
Variable
Measurement Event
DataEvent()
System
Using TRUE or FALSE conditions with logic operators such as AND and OR,
logical expressions can be encoded to perform one of the following three general
logic functions. Doing so facilitates conditional processing and control
applications:
1. Evaluate an expression, take one path or action if the expression is true (= -1),
and / or another path or action if the expression is false (= 0).
2. Evaluate multiple expressions linked with AND or OR.
3. Evaluate multiple AND or OR links.
The following commands and logical operators are used to construct logical
expressions. CRBasic example Logical Expression Examples
(p. 147)
demonstrate
some logical expressions.
• IF
• AND
• OR
• NOT
• XOR
• IMP
• IIF