2 numerical entries, 3 programming structure – Campbell Scientific CR9000X Measurement and Control System User Manual
Page 135

Section 4. CRBasic – Native Language Programming
Keywords and predefined constants are reserved for internal
CR9000X use. If a user programmed variable happens to be a
keyword or predefined constant, a runtime or compile error will
occur. To correct the error, simply change the variable. CRBasic
Help also has the list of keywords and pre-defined constants.
NOTE
See Appendix A Keywords and Predefined Constants for a list of keywords
and pre-defined constants.
• Common instructions – Instructions and operators used in most BASIC
languages, including program control statements, and logic and
mathematical operators.
• Special instructions – Instructions unique to CRBASIC, including
measurement instructions that access measurement channels, and
processing instructions that compress many common calculations used in
CR9000X dataloggers.
These four elements must be properly placed within the program structure.
4.2.2 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.2.2-1).
TABLE 4.2.2-1 Formats for Entering
Numbers in CRBasic
Format Example
Base10
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 on the right represents port 1.
This is much easier to visualize than entering 72, the decimal equivalent.
4.2.3 Programming Structure
A typical CRBasic program contains:
a) Variable
Declarations
b) Data Table Definitions
c) Subroutine Definitions (The use of subroutines is optional)
d) Program(s) including the Scan Interval, Measurements, Processes, Controls, and calls to
Data Tables
4-7