Section 4. crbasic - native language programming, 1 format introduction, 1 mathematical operations – Campbell Scientific CR5000 Measurement and Control Module User Manual

Page 77: 2 measurement and output processing instructions

Advertising
background image

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)

Advertising