6 expressions, Expressions -58 – Campbell Scientific LoggerNet Datalogger Support Software User Manual

Page 276

Advertising
background image

Section 7. Creating and Editing Datalogger Programs

7.4.2.6 Expressions

Algebraic expressions can be used in a program to easily perform processing

on input locations. When a datalogger program that contains an expression is

compiled, the appropriate instructions are automatically incorporated into the

DLD file. As an example, the following expression could be used to convert

temperature in degrees Celsius to temperatures in degrees Fahrenheit:

TempF=TempC*1.8+32

Following are rules for creating expressions:

Expressions must be set equal to the label of the Input Location that will

store the result. The result label must be to the left of the expression.

Expressions can have both fixed numbers and Input Location labels. Input

Locations can only be referenced by their label; each number in an expression

is assumed to be a constant.

Floating-point numbers are limited to six digits plus the decimal point and

sign.

The operator(s) and/or function(s) used in the expression are limited to

those in the Operator and Function list (TABLE 7-5 below).

Numbers and labels that appear immediately after a function must be

enclosed in parentheses.

Several operators and/or functions can be used in one expression.

Operations and functions that are enclosed in parentheses are calculated

first; the innermost parentheses are evaluated first.

To continue an expression to the next line, end the first line with an

underscore ( _ ).

7-58

Advertising