Specifications

Section 9. CR1000 Programming
9-13
EXAMPLE 9.7-1. CRBASIC Code: Definition and Use of a Data Table
'CR1000
'Declare Variables
Public Batt_Volt
Public PTemp_C
Public Temp_C(2)
‘Define Units
Units Batt_Volt=Volts
Units PTemp_C=Deg C
Units Temp_C(2)=Deg C
'Define Data Tables
DataTable(OneMin,True,-1)
DataInterval(0,1,Min,10)
Average(1,Batt_Volt,FP2,False)
Average(1,PTemp_C,FP2,False)
Average(2,Temp_C(1),FP2,False)
EndTable
DataTable(Table1,True,-1)
DataInterval(0,1440,Min,0)
Minimum(1,Batt_Volt,FP2,False,False)
EndTable
'Main Program
BeginProg
Scan(5,Sec,1,0)
'Default Datalogger Battery Voltage measurement Batt_Volt:
Battery(Batt_Volt)
'Wiring Panel Temperature measurement PTemp_C:
PanelTemp(PTemp_C,_60Hz)
'Type T (copper-constantan) Thermocouple measurements Temp_C:
TCDiff(Temp_C(),2,mV2_5C,1,TypeT,PTemp_C,True,0,_60Hz,1,0)
'Call Data Tables and Store Data
CallTable(OneMin)
CallTable(Table1)
NextScan
EndProg
9.7.1 Data Tables
As shown in EXAMPLE 9.7-1, 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.