3 mathematical expressions, 4 measurement and output processing instructions, 3 mathematical – Campbell Scientific PC400 Datalogger Support Software User Manual

Page 184: Expressions -22

Advertising
background image

Section 9. Datalogger Program Creation with CRBasic Editor

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

As an example of Measurement Processing, to convert a thermocouple
measurement from degrees Celsius to degrees Fahrenheit, you could use the
following expression:

TCTempF=TCTemp(1)*1.8+32

Logical Evaluation expressions could be used to determine the flow of a
program:

If TCTemp(1) > 100 Then
Call Subroutine1
Else
'enter code for main program

End If


Many parameters will allow the entry of expressions. In the following
example, the DataTable will be triggered, and therefore data stored, if
TCTemp(1)>100.

DataTable(TempTable, TCTemp(1)>100, 5000)

9.4.4 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)

PanelTemp is the keyword name of the instruction. The two parameters
associated with PanelTemp are: Destination, the name of the variable in which
to put the temperature; and Integration, the length of time to integrate the
measurement. To place the panel temperature in the variable RefTemp (using a
250 microsecond measurement integration time) the code is:

PanelTemp(RefTemp, 250)

9-22

Advertising