2 program declarations, 3 mathematical expressions – Campbell Scientific RTDAQ Software User Manual

Page 81

Advertising
background image

Section 5. Program Creation and Editing

Program

The program section defines the action of

datalogging.

Set scan interval

The scan sets the interval for a series of

measurements.

Measurements

Enter the measurements to make.

Processing

Enter any additional processing with the

measurements.

Call Data Table(s)

The Data Table must be called to process

output data.

Initiate controls

Check measurements and Initiate controls if

necessary.

NextScan

Loop back (and wait if necessary) for the next

scan.

End Program

5.1.4.2 Program Declarations

Variables must be declared before they can be used in the program. Variables
declared as Public can be viewed in display software. Variables declared
using Dim cannot be viewed. Variables assigned to a fixed value are used as
constants.

For example, in a CRBasic program there may be multiple temperature (or
other) sensors that are wired to sequential channels. Rather than insert
multiple instructions and several variables, a variable array with one name and
many 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

Aliases can also be created that will allow an element of an array or another
data result to be referred to by a different name. To continue the example
above, TCTemp(3) could be renamed using the following syntax:

Alias TCTemp(3) = AirTemp

In the display software, the more descriptive alias, AirTemp, would be used for
the cell name.

5.1.4.3 Mathematical Expressions

Mathematical expressions can be entered algebraically into program code to
perform processing on measurements, to be used for logical evaluation, or to
be used in place of some parameters.

5-21

Advertising