beautypg.com

4 expressions in parameters, 5 arrays of multipliers and offsets – Campbell Scientific CR200/CR200X-series Dataloggers User Manual

Page 98

background image

Section 9. Programming

9.9.4 Expressions in Parameters

Read More! See

Expressions

(p. 87) for more information on expressions.

Many parameters allow the entry of expressions. If an expression is a

comparison, it will return -1 if the comparison is true and 0 if it is false (

Logical

Expressions

(p. 88)).

CRBASIC EXAMPLE. Use of Expressions in Parameters

(p. 86) shows an example of the use of expressions in parameters in the

DataTable instruction, where the trigger condition is entered as an expression.

Suppose the variable TC is a thermistor temperature:

CRBASIC EXAMPLE 13.

Use of Expressions in Parameters

'DataTable (Name, TrigVar, Size)

DataTable (Temp, TC > 100, 5000)

When the trigger is "TC > 100", a TC temperature > 100 will set the trigger to

true and data is stored.

9.9.5 Arrays of Multipliers and Offsets

A single measurement instruction can measure a series of sensors and apply

individual calibration factors to each sensor as shown in

CRBASIC EXAMPLE.

Use of Arrays as Multipliers and Offsets

(p. 86). Storing calibration factors in

variable arrays, and placing the array variables in the multiplier and offset

parameters of the measurement instruction, makes this possible. The

measurement instruction uses repetitions to implement this feature by stepping

through the multiplier and offset arrays as it steps through the measurement

input channels. If the multiplier and offset are not arrays, the same multiplier

and offset are used for each repetition.

CRBASIC EXAMPLE 14.

Use of Arrays as Multipliers and Offsets

Public Pressure(3), Mult(3), Offset(3)

DataTable (AvgPress,1,-1)

DataInterval (0,60,Min)

Average (3,Pressure(),IEEE4,0)

EndTable

BeginProg

'Calibration Factors:

Mult(1)=0.123 : Offset(1)=0.23

Mult(2)=0.115 : Offset(2)=0.234

Mult(3)=0.114 : Offset(3)=0.224

Scan (1,Sec)

'VoltSe instruction using array of multipliers and offsets:

VoltSe (Pressure(),3,1,Mult(),Offset())

CallTable AvgPress

NextScan

EndProg

86