Campbell Scientific CR200 Operation Manual - Page 86

Structure

Page 86 highlights

Section 9. Programming 9.5 Structure TABLE. CRBASIC Program Structure (p. 72) delineates CRBASIC program structure: Table 6. CRBASIC Program Structure Declarations Define datalogger memory usage. Declare constants, variables, aliases, units, and data tables. Declare constants List fixed constants Declare Public variables List / dimension variables viewable during program execution Dimension variables List / dimension variables not viewable during program execution. Define Aliases Assign aliases to variables. Define Units Assign engineering units to variable (optional). Units are strictly for documentation. The CR200(X) makes no use of Units nor checks Unit accuracy. Define data tables. Define stored data tables Process/store trigger Set triggers when data should be stored. Triggers may be a fixed interval, a condition, or both. Table size Set the size of a data table Processing of Data List data to be stored in the data table, e.g. samples, averages, maxima, minima, etc. Processes or calculations repeated during program execution can be packaged in a subroutine and called when needed rather than repeating the code each time. Begin Program Begin Program defines the beginning of statements defining datalogger actions. Set scan interval The scan sets the interval for a series of measurements Measurements Enter measurements to make Processing Enter any additional processing Call Data Table(s) Declared data tables must be called to process and store data Initiate controls Check measurements and initiate controls if necessary NextScan Loop back to Set Scan and wait for the next scan End Program End Program defines the ending of statements defining datalogger actions. CRBASIC EXAMPLE. Proper Program Structure (p. 73) demonstrates the proper structure of a CRBASIC program. 72

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147
  • 148
  • 149
  • 150
  • 151
  • 152
  • 153
  • 154
  • 155
  • 156
  • 157
  • 158
  • 159
  • 160
  • 161
  • 162
  • 163
  • 164
  • 165
  • 166
  • 167
  • 168
  • 169
  • 170
  • 171
  • 172
  • 173
  • 174
  • 175
  • 176
  • 177
  • 178
  • 179
  • 180
  • 181
  • 182
  • 183
  • 184
  • 185
  • 186
  • 187
  • 188
  • 189
  • 190
  • 191
  • 192
  • 193
  • 194
  • 195
  • 196
  • 197
  • 198
  • 199
  • 200
  • 201
  • 202
  • 203
  • 204
  • 205
  • 206
  • 207
  • 208
  • 209
  • 210

Section 9.
Programming
9.5
Structure
TABLE. CRBASIC Program Structure
(p. 72) delineates CRBASIC program
structure:
Table 6.
CRBASIC Program Structure
Declarations
Define datalogger memory usage. Declare constants,
variables, aliases, units, and data tables.
Declare constants
List fixed constants
Declare Public variables
List / dimension variables viewable during program
execution
Dimension variables
List / dimension variables not viewable during program
execution.
Define Aliases
Assign aliases to variables.
Define Units
Assign engineering units to variable (optional). Units
are strictly for documentation. The CR200(X) makes no
use of Units nor checks Unit accuracy.
Define data tables.
Define stored data tables
Process/store trigger
Set triggers when data should be stored. Triggers may
be a fixed interval, a condition, or both.
Table size
Set the size of a data table
Processing of Data
List data to be stored in the data table, e.g. samples,
averages, maxima, minima, etc.
Processes or calculations repeated during program
execution can be packaged in a subroutine and called
when needed rather than repeating the code each time.
Begin Program
Begin Program defines the beginning of statements
defining datalogger actions.
Set scan interval
The scan sets the interval for a series of measurements
Measurements
Enter measurements to make
Processing
Enter any additional processing
Call Data Table(s)
Declared data tables must be called to process and
store data
Initiate controls
Check measurements and initiate controls if necessary
NextScan
Loop back to Set Scan and wait for the next scan
End Program
End Program defines the ending of statements defining
datalogger actions.
CRBASIC EXAMPLE. Proper Program Structure
(p. 73) demonstrates the
proper structure of a CRBASIC program.
72