2 program declarations, Program declarations -41 – Campbell Scientific LoggerNet Datalogger Support Software User Manual

Page 259

Advertising
background image

Section 7. Creating and Editing Datalogger Programs

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

7.3.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.

7-41

Advertising