Program Control Logical; Constructions - Campbell 21X Operator's Manual

Micrologger
Table of Contents

Advertisement

SECTION
3.
INSTRUCTION SET
BASICS
set
high.
This
flag is used to restrict sampling
for averages,
totals, maxima, minima, etc., to
times when certain criteria
are
met.
The
flag
is
automatically set low
at
the beginning
of
the
program table.
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.
Instruction
89 is placed just
before lnstruction
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.
Entry
Description
89
lf wind speed <
4.5 m/s
14
Wind
speed location
4
Comparison:<
4.5
Minimum wind speed
for histogram
19
Set Flag
t
high
75
Histogram
86
Do
29
Set Flag
9 Low
3.8
PROGRAM CONTROL LOGICAL
CONSTRUCTIONS
Most
of
the Program Control lnstructions have
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
these codes.
TABLE
3.8-1.
Command Codes
Inst.
Loc.
X
0
1-9,77-99
10-1
I
20-29
30
31
32
41-46
51-56
61-66
71-76
Go to end of program table
Call
Subroutine
1-9,
77-99
Set Flag
0-9
high
Set Flag
0-9 low
Then
Do
Exit loop
if
true
Exit loop
if
false
Setport1-6high
Setportl-6low
Toggleportl
-6
-
Pulse
port
1
-
6
100
ms
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 Instruction 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 available to
the
user
for
general programming
needs. The
user flags
can be rnanually toggled from
the keyboard
in
the *6 Mode (Section 1.3) or from
a
computer
using
TERM's monitor
feature.
By inserting flag
tests (lnstruction 91) at appropriate points
in
the
program,
the user can manually set flags to
direct program execution.
3.8.1
IF
THEN/ELSE COMPARISONS
When Command 30, THEN DO, is used with
one
of
the lF Instructions, 88-92, the instruction
is
followed immediately by instructions to
execute
if
the
comparison
is
true.
The Else
lnstruction,
94,
is
optional and
is
followed by the
instructions to
execute
if
the
comparison
is
false. The
End Instruction,
95, marks the end
of
the branching started
by
the lF Instruction.
Subsequent instructions are executed
regardless of the outcome
of
the comparison
(Figure 3.8-1).
rF
(8J
0R
88-92
W|TH
COMMAND
I
TRUE
ErsE
(e4)
(es)
FIGURE
3.8-1. lf Then/Else Execution
Sequence
X+1
X+2
P
1
2
3
4
P
P
1
FALSE
i
IND
I
3-4

Advertisement

Table of Contents
loading

Table of Contents