07.01.2015 Views

CR200/CR200X Series Dataloggers - Campbell Scientific

CR200/CR200X Series Dataloggers - Campbell Scientific

CR200/CR200X Series Dataloggers - Campbell Scientific

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Section 9. Programming<br />

CRBASIC EXAMPLE 8.<br />

'Declare Variables<br />

Public Batt_Volt<br />

Public T109_C(2)<br />

Definition and Use of a Data Table<br />

'Define Units<br />

Units Batt_Volt=Volts<br />

Units T109_C(2)=Deg C<br />

'Define Data Tables<br />

DataTable (OneMin,True,-1)<br />

DataInterval (0,1,Min)<br />

Average (1,Batt_Volt,False)<br />

Average (2,T109_C(1),False)<br />

EndTable<br />

DataTable (Table1,True,-1)<br />

DataInterval (0,1440,Min)<br />

Minimum (1,Batt_Volt,False,False)<br />

EndTable<br />

'Main Program<br />

BeginProg<br />

Scan (5,Sec)<br />

'Default Datalogger Battery Voltage measurement Batt_Volt:<br />

Battery (Batt_Volt)<br />

NextScan<br />

EndProg<br />

'109-L Thermistor measurements Temp_C:<br />

Therm109(T109_C(),2,1,Ex1,1,0)<br />

'Call Data Tables and Store Data<br />

CallTable (OneMin)<br />

CallTable (Table1)<br />

As shown in CRBASIC EXAMPLE. Definition and Use of a Data Table (p. 79),<br />

data table declaration begins with the DataTable () instruction and ends with the<br />

EndTable () instruction. Between DataTable () and EndTable () are instructions<br />

that define what data to store and under what conditions data are stored. A data<br />

table must be called by the CRBASIC program for data storage processing to<br />

occur. Typically, data tables are called by the CallTable () instruction once each<br />

Scan.<br />

9.7.1.1 DataTable () and EndTable () Instructions<br />

The DataTable instruction has three parameters: a user-specified alphanumeric<br />

name for the table (e.g., "OneMin"), a trigger condition (e.g., "True"), and the<br />

size to make the table in RAM (e.g., auto allocated).<br />

• Name-The table name can be any combination of numbers and letters up to<br />

16 characters in length. The first character must be a letter.<br />

80

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!