B-6. Definition And Use Of A Data Table - Campbell CR300 Series Operator's Manual

Hide thumbs Also See for CR300 Series:
Table of Contents

Advertisement

Appendix B. Introduction to CRBasic Programming
CRBasic Example B-6. Definition and Use of a Data Table
'This program example demonstrates definition and use of data tables.
'Declare Variables
Public
BattV
Public
PTemp_C
Public
Temp_C
'Define Units
Units
BattV=Volts
Units
PTemp_C=Deg_C
Units
Temp_C=Deg_C
'Define Data Tables
DataTable(OneMin,True,-1)
DataInterval(0,1,Min,10)
Average(1,BattV,FP2,False)'Optional instruction to average variable BattV
Average(1,PTemp_C,FP2,False)
Average(1,Temp_C,FP2,False)
EndTable
'Main Program
BeginProg
Scan(1,Sec,1,0)
'Default Datalogger Battery Voltage measurement 'BattV'
Battery(BattV)
'Processing Board Temperature measurement 'PTemp_C'
PanelTemp(PTemp_C,400)
'Type T (copper-constantan) Thermocouple measurement 'Temp_C'
TCDiff(Temp_C,1,mV34,1,TypeT,PTemp_C,True,0,60,1,0)
'Call Data Tables and Store Data
CallTable
OneMin
NextScan
EndProg
B-8
'Required beginning of data table declaration
'Optional instruction to trigger table at one-minute interval
'Optional instruction to average variable PTemp_C
'Optional instruction to average variable Temp_C
'Required end of data table declaration
TABLE 5-2, Typical Data Table
data table is downloaded from a CR300 programmed with the code in CRBasic
Example B-6. See Section 5.7, Collecting Data
final data files.
As shown in CRBasic Example B-6, data table declaration begins with the
DataTable() instruction and ends with the EndTable() instruction. Between
DataTable() and EndTable() are instructions that define what data to store
and under what conditions data are stored. A data table must be called by the
CRBasic program for data storage processing to occur. Typically, data tables
are called by the CallTable() instruction once each Scan.
DataTable() instruction and parameters are as follows:
DataTable(Name, TrigVar, Size)
Name — The table name can be any combination of numbers, letters,
and underscore up to 20 characters in length. The first character must
be a letter or underscore.
TrigVar — Controls whether or not data records are written to
storage. Data records are written to storage if TrigVar is true and if
other conditions, such as DataInterval(), are met. Default setting is
, shows a data file as it appears after the
(p. 24)
, for more information on
(p. 23)

Advertisement

Table of Contents
loading

This manual is also suitable for:

Cr300-rf407Cr300-rf412Cr300-rf422

Table of Contents