7 example program, 8 data tables, 7 example – Campbell Scientific PC400 Datalogger Support Software User Manual
Page 186: Program -24, 8 data, Tables -24

Section 9. Datalogger Program Creation with CRBasic Editor
9.4.7 Example Program
The following program will serve as a programming example in this section to
illustrate the concepts and program structure. This is a program for a CR5000
datalogger. Note that other dataloggers may have slightly different parameters
for some instructions.
Const
RevDiff=1
Const
Del=0
Const
Integ=250
Const
Mult=1
Const
Offset=0
Public
RefTemp
Public
TC(6)
Units
RefTemp=degC
Units
TC=DegC
DataTable
(Temp,1,2000)
DataInterval
(0,100,mSec,10)
Average
(1,RefTemp,FP2,0)
Average
(6,TC(),FP2,0)
EndTable
BeginProg
Scan
(10,mSec,3,0)
PanelTemp
(RefTemp, 250)
TCDiff
(TC(),6,mV20C ,1,TypeT,RefTemp,RevDiff,Del,Integ,Mult,Offset)
CallTable
Temp
NextScan
EndProg
Declare public variables ,
dimension array, and
declare units.
Declare constants
Define Data Table
Declarations
Scan loop
Measure
Call Data Table
9.4.8 Data Tables
Data storage follows a fixed structure in the datalogger in order to optimize the
time and space required. Data are stored in tables such as:
TOA5
StnName Temp
TIMESTAMP
RECORD RefTemp_Avg TC_Avg(1) TC_Avg(2) TC_Avg(3) TC_Avg(4) TC_Avg(5) TC_Avg(6)
TS
RN
degC
DegC
degC
degC
degC
degC
degC
Avg
Avg
Avg
Avg
Avg
Avg
Avg
1995-02-16
15:15:04.61
278822
31.08
24.23 25.12 26.8 24.14 24.47 23.76
1995-02-16
15:15:04.62
278823
31.07
24.23 25.13 26.82 24.15 24.45 23.8
1995-02-16
15:15:04.63
278824
31.07
24.2 25.09 26.8 24.11 24.45 23.75
1995-02-16
15:15:04.64
278825
31.07
24.21 25.1 26.77 24.13 24.39 23.76
The user’s program determines the values that are output and their sequence.
The datalogger automatically assigns names to each field in the data table. In
the above table, TIMESTAMP, RECORD, RefTemp_Avg, and TC_Avg(1) are
fieldnames. The fieldnames are a combination of the variable name (or alias if
one exists) and a three letter mnemonic for the processing instruction that
outputs the data. Alternatively, the FieldNames instruction can be used to
override the default names.
9-24