Specifications

Section 4. CRBasic - Native Language Programming
4-10
port 1. This is much easier to visualize than entering 72, the decimal
equivalent.
4.6 Logical Expression Evaluation
4.6.1 What is True?
Several different words get used to describe a condition or the result of a test.
The expression, X>5, is either true or false. However, when describing the
state of a port or flag, on or off or high or low sounds better. In CRBasic there
are a number of conditional tests or instruction parameters the result of which
may be described with one of the words in Table 4.6-1. The CR3000 evaluates
the test or parameter as a number; 0 is false, not equal to 0 is true.
TABLE 4.6-1. Synonyms for True and False
Predefined Constant True (-1) False (0)
Synonym High Low
Synonym On Off
Synonym Yes No
Synonym Trigger Do Not Trigger
Number
0
0
Digital port 5 Volts 0 Volts
4.6.2 Expression Evaluation
Conditional tests require the CR3000 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 CR3000 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 8). A
condition can include multiple and and or links.
4.6.3 Numeric Results of Expression Evaluation
The CR3000 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.