Campbell Scientific CR10 CR10 Measurement and Control - Page 54

coNsTRucTroNs

Page 54 highlights

SECTION 3. INSTRUCTION SET BASICS As an example, suppose it is desired to obtain a wind speed rose incorporating only wind speeds greater than or equal to 4.5 m/s. The wind speed rose is computed using the Histogram Instruction 75, and wind speed is stored in input location 14, in m/s. lnstruction 89 is placed just before Instruction 75 and is used to set Flag 9 high if the wind speed is less than 4.5 m/s: TABLE 3.7-2. Example of the Use of Flag 9 Inst. Param. Loc. No. Entrv Description X P89 't 14 lf wind speed < 4.5 m/s Wind speed location 24 Comparison: < 3 4.5 Minimum wind 419 X+1 P75 X+2 P86 speed for histogram Set Flag t high Histogram Do Set Flaq 9 Low NOTE: Flag 9 is automatically reset the same as Flag 0. lf the intermediate processing disable flag is already set high and the test condition of a subsequent Program Control lnstruction acting on Flag 9 fails, the flag is set low. This feature eliminates having to enter another instruction to specifically reset Flag 9 before proceeding to another group of test conditions. 3.7.3 USER FLAGS Flags 1-8 are not dedicated to a specific purpose and are availabb to the user for general programming needs. The user flags can be manually toggled from the keyboard in the *6 Mode (Section 1.3). By inserting the flag test (lnstruction 91) at appropriate points in the program, the user can use the "6 Mode to manually direct program execution. 3.8 PROGRAM CONTROL LOGICAL coNsTRucTroNs Most of the Program Control Instructions have a command code parameter which is used to specify the action to be taken if the condition tested in the instruction is true. Table 3.8-1 lists these codes. TABLE 3.&1. Command Godes 0 1-9,79-99 10-19 20-29 30 31 32 41-48 51-58 61-68 71-78 - Go to end of program table - Call Subroutine 1-9, 79-991 Set Flag 0-9 high Set Flag 0-9low Then Do Exit loop if true Exit loop if false Set Port 1-8 nignz Set Port 1-8low2 Toggle Port 1-82 Pulse Port 1-82 1 97 and 98 are specialsubroutines which can be called by Control ports 7 and 8 going high; see lnstruction 85 for details. 2 Ports can be indexed to the loop counter 3.8.1 IF THEN/ELSE COMPARISONS Program Control Instructions can be used for lf then/else comparisons. When Command 30 fihen do) is used with Instructions 83 or 88-92, the lf Instruction is followed immediately by instructions to execute if the comparison is true. The Else Instruction (94) is optionaland is followed by the instructions to execute if the comparison is false. The End Instruction (95) ends the lf then/else comparison and marks the beginning of the instructions that are executed regardless of the outcome of the comparison (see Figure 3.8-1). rF (83 OR 88-92 WrTH COMMAN o) I TRUE ELSI (e4) FALSE I END (es) + FIGURE 3.8-1. lf Then/Else Execution Sequence 3-4

  • 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

SECTION
3.
INSTRUCTION SET
BASICS
As an example, suppose it
is
desired
to
obtain
a
wind speed rose incorporating only wind speeds
greater than or equal to 4.5
m/s.
The wind
speed rose
is
computed
using
the
Histogram
Instruction 75, and wind
speed
is
stored in input
location
14,
in
m/s.
lnstruction
89
is placed
just
before
Instruction 75 and is used to
set
Flag
9
high
if
the wind speed is less
than
4.5 m/s:
TABLE
3.7-2.
Example
of the
Use
of
Flag
9
Param.
No.
Entrv
Inst.
Loc.
X
X+1
X+2
P89
't
14
24
3
4.5
419
P75
P86
Description
lf wind speed
<
4.5 m/s
Wind
speed location
Comparison:
<
Minimum wind
speed
for
histogram
Set
Flag
t
high
Histogram
Do
Set Flaq 9 Low
NOTE: Flag
9
is
automatically reset
the
same
as
Flag
0.
lf
the
intermediate
processing disable
flag
is
already set high
and the test condition of
a
subsequent
Program
Control
lnstruction acting
on
Flag
9
fails, the
flag
is set
low.
This
feature
eliminates having to enter another
instruction
to
specifically reset Flag 9 before
proceeding to
another
group
of
test
conditions.
3.7.3
USER
FLAGS
Flags 1-8 are not dedicated to a specific
purpose and are
availabb
to
the
user
for
general programming
needs.
The
user flags
can be manually toggled from
the
keyboard
in
the
*6
Mode (Section
1.3).
By inserting the flag
test
(lnstruction 91) at appropriate points
in
the
program, the user
can
use
the "6
Mode to
manually direct program execution.
3.8
PROGRAM
CONTROL LOGICAL
coNsTRucTroNs
Most
of
the
Program
Control
Instructions have
a
command
code
parameter
which
is used
to
specify the action
to
be
taken
if
the condition
tested
in
the
instruction
is
true.
Table 3.8-1
lists
these codes.
3-4
TABLE
3.&1.
Command Godes
0
1-9,79-99
10-19
20-29
30
31
32
41-48
51-58
61-68
71-78
-
Go to end of program table
-
Call Subroutine 1-9,
79-991
Set Flag
0-9
high
Set Flag
0-9low
Then
Do
Exit loop
if
true
Exit loop
if
false
Set Port 1-8
nignz
Set Port
1-8low2
Toggle Port
1-82
Pulse
Port
1-82
1
97 and 98 are
specialsubroutines
which can
be
called by Control ports 7 and 8 going
high;
see
lnstruction 85 for details.
2
Ports
can
be indexed to
the
loop
counter
3.8.1
IF
THEN/ELSE
COMPARISONS
Program
Control
Instructions
can be
used
for
lf
then/else
comparisons. When
Command 30
fihen
do) is used
with
Instructions 83 or 88-92,
the lf
Instruction
is
followed
immediately by
instructions to
execute
if
the
comparison
is
true.
The
Else Instruction (94)
is
optionaland
is
followed
by
the
instructions to execute
if
the
comparison
is
false.
The End
Instruction
(95)
ends
the
lf
then/else
comparison
and marks the
beginning
of
the
instructions that are executed
regardless
of
the
outcome of the comparison
(see Figure 3.8-1).
rF
(83
OR
88-92
WrTH
COMMAN
I
TRUE
ELSI
(e4)
(es)
FIGURE
3.8-1.
lf Then/Else
Execution
Sequence
FALSE
I
END
+
o)