Section 4. CRBasic - Native Language Programming
4-6
Average(Reps, Source, DataType, DisableVar)
Average(1,RefTemp,fp2,0)
Average(6,TC(1),fp2,0)
Average is an output processing instruction that will output the average of a
variable over the output interval. The parameters are repetitions - the number
of elements in an array to calculate averages for, the Source variable or array to
average, the data format to store the result in (Table 4.3-1), and a disable
variable that allows excluding readings from the average if conditions are not
met. A reading will not be included in the average if the disable variable is not
equal to 0; the example has 0 entered for the disable variable so all readings are
included in the average.
TABLE 4.3-1 Formats for Output Data
Code
Data Format
Size
Range
Resolution
FP2
Campbell Scientific floating point
2 bytes
±
7999
13 bits (about 4 digits)
IEEE4
IEEE four byte floating point
4 bytes
1.8 E -38 to 1.7 E 38
24 bits (about 7 digits)
LONG
4 byte Signed Integer
4 bytes
-2,147,483,648 to
+2,147,483,647
1 bit (1)
4.3.2 The Scan -- Measurement Timing and Processing
Once you know what you want, the measurements and calculations have been
listed and the output tables defined, the program itself may be relatively short.
The executable program begins with BeginProg and ends with EndProg. The
measurements, processing, and calls to output tables bracketed by the Scan and
NextScan instructions determine the sequence and timing of the datalogging.
BeginProg
Scan(1,MSEC,3,0)
ModuleTemp(RefTemp, 250)
TCDiff(TC(),6,mV50,4,1,TypeT,RefTemp,RevDiff,Del,Integ,Mult,Offset)
CallTable Temp
NextScan
EndProg
The Scan instruction determines how frequently the measurements within the
scan are made:
Scan(Interval, Units, BufferSize, Count)
Scan(1,MSEC,3,0)
The Scan instruction has four parameters. The Interval is the interval between
scans. Units are the time units for the interval. The maximum scan interval is
one minute. The BufferSize is the size (in the number of scans) of a buffer in
RAM that holds the raw results of measurements. Using a buffer allows the
processing in the scan to at times lag behind the measurements without
affecting the measurement timing (see the scan instruction in Section 9 for
more details). Count is the number of scans to make before proceeding to the
instruction following NextScan. A count of 0 means to continue looping
Содержание CR5000
Страница 39: ...Section 1 Installation and Maintenance 1 15 S A N Y O FIGURE 1 11 6 Removal of band clamp and battery ...
Страница 40: ...Section 1 Installation and Maintenance 1 16 This is a blank page ...
Страница 54: ...Section 2 Data Storage and Retrieval 2 14 This is a blank page ...
Страница 88: ...Section 4 CRBasic Native Language Programming 4 12 This is a blank page ...
Страница 94: ...Section 5 Program Declarations 5 6 This is a blank page ...
Страница 172: ...Section 7 Measurement Instructions 7 46 This is a blank page ...
Страница 206: ......
Страница 236: ...Index Index 4 This is a blank page ...
Страница 237: ...This is a blank page ...