Appendix B. Introduction to CRBasic Programming
B-9
–1
(
True
).
TrigVar
may be a variable, expression, or constant.
TrigVar
does not control intermediate data processing. Intermediate
data processing is controlled by the disable variable,
DisableVar
,
which is a parameter in all output processing instructions.
•
Size
— Table size is the number of records to store in a table before
new data begins overwriting old data. If
10
is entered, 10 records are
stored in the table; the eleventh record will overwrite the first record.
If
–1
is entered, memory for the table is allocated automatically at the
time the program compiles. Automatic allocation is preferred in most
applications since the CR300 sizes all tables such that they fill (and
begin overwriting the oldest data) at about the same time.
DataInterval()
instructs the CR300 to both write data records at the specified
interval and to recognize when a record has been skipped. The interval is
(p. B-12)
; however, it must be a
multiple of the
Scan()
/
NextScan
interval.
Sometimes timing issues or program logic prevent a record from being written.
If a record is not written, the CR300 recognizes the omission as a "lapse" and
increments the
SkippedRecord
counter in the
Status
table. Lapses waste
significant memory in the data table and may cause the data table to fill sooner
than expected.
DataInterval()
instruction parameter
Lapses
controls the
CR300 response to a lapse.
B.5.1 Data Output-Processing Instructions
Data-storage processing instructions, also known as output processing
instructions, determine what data are stored in a data table. When a data table is
called in the CRBasic program, data-storage processing instructions process
variables holding current inputs or calculations. If trigger conditions are true,
for example if the data-output interval has expired, processed values are stored
into the data table. In CRBasic Example
, three averages are stored.
Consider the
Average()
instruction as an example data-storage processing
instruction.
Average()
stores the average of a variable over the data-output
interval. Its parameters are:
•
Reps
— number of sequential elements in the variable for which
averages are calculated.
Reps
is set to
1
to average
PTemp
, and set to
2
to average two thermocouple temperatures, both of which reside in
the variable array
Temp_C()
(a variable array of 2).
•
Source
— variable to average. Variables
PTemp_C
and
Temp_C()
(a
variable array of 2) are used.
•
DataType
— Data type for the stored average (the example uses data
type
FP2
). Final-data memory data types are listed in TABLE
•
DisableVar
— controls whether a measurement or value is included in
an output processing function. A measurement or value is not included
if
DisableVar
is true
(≠ 0). For example, if the disable variable in an
Average()
instruction is
True
, the current value will not be included
in the average.CRBasic Example
DisableVar
can be
used to exclude values from an averaging process. In this example,
DisableVar
is controlled by
Flag1
. When
Flag1
is true,
DisableVar
is
Содержание CR300 series
Страница 2: ......
Страница 6: ......
Страница 68: ...CR300 Series Datalogger 58...
Страница 70: ......
Страница 85: ......