beautypg.com

Campbell Scientific CR5000 Measurement and Control Module User Manual

Page 81

background image

Section 4. CRBasic - Native Language Programming

4-5

= degC). The units are strictly for the user's documentation; the CR5000
makes no checks on their accuracy.

The above table is the result of the data table description in the example
program:

DataTable (Temp,1,2000)

DataInterval(0,10,msec,10)
Average(1,RefTemp,fp2,0)
Average(6,TC(1),fp2,0)

EndTable

All data table descriptions begin with DataTable and end with EndTable.
Within the description are instructions that tell what to output and that can
modify the conditions under which output occurs.

DataTable(Name, Trigger, Size)
DataTable (Temp,1,2000)

The DataTable instruction has three parameters: a user specified name for the
table, a trigger condition, and the size to make the table in CR5000 RAM. The
trigger condition may be a variable, expression, or constant. The trigger is true
if it is not equal to 0. Data are output if the trigger is true and there are no
other conditions to be met. No output occurs if the trigger is false (=0). The
example creates a table name Temp, outputs any time other conditions are met,
and retains 2000 records in RAM.

DataInterval(TintoInt, Interval, Units, Lapses)
DataInterval(0,10,msec,10)

DataInterval is an instruction that modifies the conditions under which data are
stored. The four parameters are the time into the interval, the interval on
which data are stored, the units for time, and the number of lapses or gaps in
the interval to keep track of. The example outputs at 0 time into (on) the
interval relative to real time, the interval is 10 milliseconds, and the table will
keep track of 10 lapses. The DataInterval instruction reduces the memory
required for the data table because the time of each record can be calculated
from the interval and the time of the most recent record stored. Other output
condition modifiers are: Worst Case and FillandStop.

The output processing instructions included in a data table declaration
determine the values output in the table. The table must be called by the
program in order for the output processing to take place. That is, each time a
new measurement is made, the data table is called. When the table is called,
the output processing instructions within the table process the current inputs.
If the trigger conditions for the are true, the processed values are output to the
data table. In the example, several averages are output.