10 numerical entries, 11 logical expression evaluation, 1 what is true – Campbell Scientific RTDAQ Software User Manual

Page 87

Advertising
background image

Section 5. Program Creation and Editing

The Scan instruction determines how frequently the measurements within the
scan are made:

Scan(Interval, Units, BufferOption, Count)
Scan(1,MSEC,3,0)

The Scan instruction has four parameters (the CR200 datalogger’s Scan
instruction has only two). The Interval is the time between scans. Units are
the time units for the interval. The BufferSize is the size (in the number of
scans) of a buffer in RAM that holds the raw results of measurements. Using a
buffer allows the processing in the scan to at times lag behind the
measurements without affecting the measurement timing (see the scan
instruction in the CR5000 help for more details). Count is the number of scans
to make before proceeding to the instruction following NextScan. A count of
0 means to continue looping forever (or until ExitScan). In the example the
scan is 1 millisecond, three scans are buffered, and the measurements and
output continue indefinitely.

5.1.4.10 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 5.1-2).

TABLE 5.1-2. 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.

5.1.4.11 Logical Expression Evaluation

5.1.4.11.1 What is True?

Several different words are 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 is more intuitive. 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 5.1-3. The datalogger
evaluates the test or parameter as a number; 0 is false, not equal to 0 is true.

5-27

Advertising