4 numerical entries, 5 logical expression evaluation, 1 what is true – Campbell Scientific CR5000 Measurement and Control Module User Manual
Page 83

Section 4. CRBasic - Native Language Programming
4-7
forever (or until ExitScan). In the example the scan is 1 millisecond, three
scans are buffered, and the measurements and output continue indefinitely.
4.4 Numerical Entries
In addition to entering regular base 10 numbers there are 3 additional ways to
represent numbers in a program: scientific notation, binary, and hexadecimal
(Table 4.4-1).
TABLE 4.4-1 Formats for Entering Numbers in CRBasic
Format
Example
Value
Standard
6.832
6.832
Scientific notation
5.67E-8
5.67X10
-8
Binary:
&B1101
13
Hexadecimal
&HFF
255
The binary format makes it easy to visualize operations where the ones and
zeros translate into specific commands. For example, a block of ports can be
set with a number, the binary form of which represents the status of the ports
(1= high, 0=low). To set ports 1, 3, 4, and 6 high and 2, 5, 7, and 8 low; the
number is &B00101101. The least significant bit is on the right and represents
port 1. This is much easier to visualize than entering 72, the decimal
equivalent.
4.5 Logical Expression Evaluation
4.5.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.5-1. The CR5000 evaluates
the test or parameter as a number; 0 is false, not equal to 0 is true.
TABLE 4.5-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