4-1
Section 4. CRBasic - Native Language
Programming
The CR5000 is programmed in a language that has some similarities to a structured basic.
There are special instructions for making measurements and for creating tables of output
data. The results of all measurements are assigned variables (given names).
Mathematical operations are written out much as they would be algebraically. This
section describes a program, its syntax, structure, and sequence.
4.1 Format Introduction
4.1.1 Mathematical Operations
Mathematical operations are written out much as they would be algebraically.
For example, to convert a temperature in Celsius to Fahrenheit one might
write:
TempF = TempC * 1.8 + 32
With the CR5000 there may be 2 or 20 temperature (or other) measurements.
Rather than have 20 different names, a variable array with one name and 20
elements may be used. A thermocouple temperature might be called TCTemp.
With an array of 20 elements the names of the individual temperatures are
TCTemp(1), TCTemp(2), TCTemp(3), ... TCTemp(20). The array notation
allows compact code to perform operations on all the variables. For example,
to convert ten temperatures in a variable array from C to F:
For I=1 to 10
TCTemp(I)=TCTemp(I)*1.8+32
Next I
4.1.2 Measurement and Output Processing Instructions
Measurement instructions are procedures that set up the measurement
hardware to make a measurement and place the results in a variable or a
variable array. Output processing instructions are procedures that store the
results of measurements or calculated values. Output processing includes
averaging, saving maximum or minimum, standard deviation, FFT, etc.
The instructions for making measurements and outputting data are not found in
a standard basic language. The instructions Campbell Scientific has created for
these operations are in the form of procedures. The procedure has a keyword
name and a series of parameters that contain the information needed to
complete the procedure. For example, the instruction for measuring the
temperature of the CR5000 input panel is:
PanelTemp
(Dest, Integ)
Summary of Contents for CR5000
Page 40: ...Section 1 Installation and Maintenance 1 16 This is a blank page ...
Page 54: ...Section 2 Data Storage and Retrieval 2 14 This is a blank page ...
Page 88: ...Section 4 CRBasic Native Language Programming 4 12 This is a blank page ...
Page 94: ...Section 5 Program Declarations 5 6 This is a blank page ...
Page 172: ...Section 7 Measurement Instructions 7 46 This is a blank page ...
Page 206: ......
Page 236: ...Index Index 4 This is a blank page ...
Page 237: ...This is a blank page ...