![Campbell CR5000 Скачать руководство пользователя страница 84](http://html1.mh-extra.com/html/campbell/cr5000/cr5000_operators-manual_489195084.webp)
Section 4. CRBasic - Native Language Programming
4-8
4.5.2 Expression Evaluation
Conditional tests require the CR5000 to evaluate an expression and take one
path if the expression is true and another if the expression is false. For
example:
If X>=5 then Y=0
will set the variable Y to 0 if X is greater than or equal to 5.
The CR5000 will also evaluate multiple expressions linked with and or or.
For example:
If X>=5 and Z=2 then Y=0
will only set Y=0 if both X>=5 and Z=2 are true.
If X>=5 or Z=2 then Y=0
will set Y=0 if either X>=5 or Z=2 is true (see And and Or in Section 9). A
condition can include multiple and and or links.
4.5.3 Numeric Results of Expression Evaluation
The CR5000 expression evaluator evaluates an expression and returns a
number. A conditional statement uses the number to decide which way to
branch. The conditional statement is false if the number is 0 and true if the
number is not 0. For example:
If 6 then Y=0,
is always true, Y will be set to 0 any time the conditional statement is executed.
If 0 then Y=0
is always false, Y will never be set to 0 by this conditional statement.
The CR5000 expression evaluator evaluates the expression, X>=5, and returns
-1, if the expression is true, and 0, if the expression is false.
W=(X>Y)
will set W equal to -1 if X>Y or will set W equal to 0 if X<=Y.
The CR5000 uses -1 rather than some other non-zero number because the and
and or operators are the same for logical statements and binary bitwise
comparisons (see and and or in Section 8). The number -1 is expressed in
binary with all bits equal to 1, the number 0 has all bits equal to 0. When -1 is
anded with any other number the result is the other number, ensuring that if the
other number is non-zero (true), the result will be non-zero
4.6 Flags
Any variable can be used as a flag as far as logical tests in CRBasic are
concerned. If the value of the variable is non-zero the flag is high. If the value
of the variable is 0 the flag is low (Section 4.5). PC9000 looks for the variable
array with the name Flag when the option to display flag status is used in one
of the real time screens.
Содержание CR5000
Страница 39: ...Section 1 Installation and Maintenance 1 15 S A N Y O FIGURE 1 11 6 Removal of band clamp and battery ...
Страница 40: ...Section 1 Installation and Maintenance 1 16 This is a blank page ...
Страница 54: ...Section 2 Data Storage and Retrieval 2 14 This is a blank page ...
Страница 88: ...Section 4 CRBasic Native Language Programming 4 12 This is a blank page ...
Страница 94: ...Section 5 Program Declarations 5 6 This is a blank page ...
Страница 172: ...Section 7 Measurement Instructions 7 46 This is a blank page ...
Страница 206: ......
Страница 236: ...Index Index 4 This is a blank page ...
Страница 237: ...This is a blank page ...