Campbell Scientific CR5000 CR5000 Measurement and Control Module - Page 77

CRBasic - Native Language Programming, 4.1 Format Introduction

Page 77 highlights

Section 4. CRBasic - Native Language Programming The CR5000 is programmed in a language that has some similarities to a structured basic. There are special instructions for making measurements and for creating tables of output data. The results of all measurements are assigned variables (given names). Mathematical operations are written out much as they would be algebraically. This section describes a program, its syntax, structure, and sequence. 4.1 Format Introduction 4.1.1 Mathematical Operations Mathematical operations are written out much as they would be algebraically. For example, to convert a temperature in Celsius to Fahrenheit one might write: TempF = TempC * 1.8 + 32 With the CR5000 there may be 2 or 20 temperature (or other) measurements. Rather than have 20 different names, a variable array with one name and 20 elements may be used. A thermocouple temperature might be called TCTemp. With an array of 20 elements the names of the individual temperatures are TCTemp(1), TCTemp(2), TCTemp(3), ... TCTemp(20). The array notation allows compact code to perform operations on all the variables. For example, to convert ten temperatures in a variable array from C to F: For I=1 to 10 TCTemp(I)=TCTemp(I)*1.8+32 Next I 4.1.2 Measurement and Output Processing Instructions Measurement instructions are procedures that set up the measurement hardware to make a measurement and place the results in a variable or a variable array. Output processing instructions are procedures that store the results of measurements or calculated values. Output processing includes averaging, saving maximum or minimum, standard deviation, FFT, etc. The instructions for making measurements and outputting data are not found in a standard basic language. The instructions Campbell Scientific has created for these operations are in the form of procedures. The procedure has a keyword name and a series of parameters that contain the information needed to complete the procedure. For example, the instruction for measuring the temperature of the CR5000 input panel is: PanelTemp (Dest, Integ) 4-1

  • 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
  • 211
  • 212
  • 213
  • 214
  • 215
  • 216
  • 217
  • 218
  • 219
  • 220
  • 221
  • 222
  • 223
  • 224
  • 225
  • 226
  • 227
  • 228
  • 229
  • 230
  • 231
  • 232
  • 233
  • 234
  • 235
  • 236
  • 237
  • 238

4-1
Section 4.
CRBasic - Native Language
Programming
The CR5000 is programmed in a language that has some similarities to a structured basic.
There are special instructions for making measurements and for creating tables of output
data.
The results of all measurements are assigned variables (given names).
Mathematical operations are written out much as they would be algebraically.
This
section describes a program, its syntax, structure, and sequence.
4.1
Format Introduction
4.1.1
Mathematical Operations
Mathematical operations are written out much as they would be algebraically.
For example, to convert a temperature in Celsius to Fahrenheit one might
write:
TempF = TempC * 1.8 + 32
With the CR5000 there may be 2 or 20 temperature (or other) measurements.
Rather than have 20 different names, a
variable array
with one name and 20
elements may be used.
A thermocouple temperature might be called TCTemp.
With an array of 20 elements the names of the individual temperatures are
TCTemp(1), TCTemp(2), TCTemp(3), ... TCTemp(20).
The array notation
allows compact code to perform operations on all the variables.
For example,
to convert ten temperatures in a variable array from C to F:
For I=1 to 10
TCTemp(I)=TCTemp(I)*1.8+32
Next I
4.1.2
Measurement and Output Processing Instructions
Measurement instructions are procedures that set up the measurement
hardware to make a measurement and place the results in a variable or a
variable array.
Output processing instructions are procedures that store the
results of measurements or calculated values.
Output processing includes
averaging, saving maximum or minimum, standard deviation, FFT, etc.
The instructions for making measurements and outputting data are not found in
a standard basic language.
The instructions Campbell Scientific has created for
these operations are in the form of procedures.
The procedure has a keyword
name and a series of parameters that contain the information needed to
complete the procedure.
For example, the instruction for measuring the
temperature of the CR5000 input panel is:
PanelTemp
(Dest, Integ)