beautypg.com

Campbell Scientific CR9000X Measurement and Control System User Manual

Page 174

background image

Section 5. Program Declarations

The constant table is accessed by using the CR1000KD keyboard display
(Configure, Settings menu). A Constant Table menu item will exist only if the
ConstTable/EndConstTable declaration has been used in the program.

The ConstTable allows a way to have a value that is changeable in an
instruction parameter that requires a constant (for instance, the interval for the
Scan instruction will not accept a variable). For users who are familiar with
CR10X, CR23X, and CR510 dataloggers, the ConstTable is similar to the *4
Table functionality.

ConstTable Example

This example uses ConstTable to change the Scan Rate of the program and the

integration time for the TCDiff instruction.

ConstTable

Const ScanRate = 10
Const Integ = 40

EndConstTable

Const Reps = 5
Public TRef, TCDiff(reps)

DataTable (Test,1,-1)
DataInterval (0,60,Sec,10)
Sample

(1,TRef,FP2)

Sample

(Reps,TCDest(),FP2)

EndTable

'Main Program
BeginProg
Scan (ScanRate,Sec,0,0)
ModuleTemp(MTemp,1,4,250)
TCDiff(TCDest(),Reps,mV50C,4,1,TypeT,Tref,0,0,Integ,1.0,0)
CallTable Test
NextScan
EndProg

DIM

The Dim statement is used to declare variables and variable arrays, and
allocate storage space for these variables.

Syntax

Dim

VarName (size subscripts)

Or

Dim

VarName (size subscripts) As Type

Or

Dim

VarName (size subscripts) As Type = {3,6,2, . , , ,5}[initialise values]

Remarks
In CRBasic, ALL variables MUST be declared. Variables are typically declared at
the beginning of the program and are initialized to a value of 0 unless otherwise
declared.

5-4