Section 4. CRBasic - Native Language Programming
4-4
4.3 Example Program
Const
RevDiff=1
Const
Del=0
'default
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
4.3.1 Data Tables
Data storage follows a fixed structure in the CR5000 in order to optimize the
time and space required. Data are stored in tables such as:
TOA4
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 CR5000 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.
The data table header also has a row that lists units for the output values. The
units must be declared for the CR5000 to fill this row out (e.g., Units RefTemp
Declare public variables ,
dimension array, and
declare units.
Declare constants
Define Data Table
Declarations
Scan loop
Measure
Call Data Table
Summary of Contents for CR5000
Page 40: ...Section 1 Installation and Maintenance 1 16 This is a blank page ...
Page 54: ...Section 2 Data Storage and Retrieval 2 14 This is a blank page ...
Page 88: ...Section 4 CRBasic Native Language Programming 4 12 This is a blank page ...
Page 94: ...Section 5 Program Declarations 5 6 This is a blank page ...
Page 172: ...Section 7 Measurement Instructions 7 46 This is a blank page ...
Page 206: ......
Page 236: ...Index Index 4 This is a blank page ...
Page 237: ...This is a blank page ...