Probessing And Program Control Examples - Campbell 21X Operator's Manual

Micrologger
Table of Contents

Advertisement

8.
PROCESSING
AND PROGRAM CONTROL EXAMPLES
The
examples are
intended
to
illustrate the use of Processing and
Program Control
flags,
and the capability to direct
the
results
of Output Processing lnstructions to lnput
Storage.
The
specific]examples may not be
as important as some of the techniques employed, for example:
Directin|
Output Processing to
lnput Storage is used in the Running Average and Hainfall lntensity
exampl4s (8.1 and
8.2).
Ftags tepts
are used
in the Running Average, lnterrupt Subroutine, and Converting Wind Direction
examplQs (8.1, 8.5, and 8.7)
Controlports and the Loop are illustrated in
the
AM416 example
(8.3).
These
exanlples are not complete programs
to
be taken
verbatim.
They
need
to
be
altered
to
fit
specific
needs.
8.1
COMPUTATION OF RUNNING
AVERAGE
necessary to
compute a running
average
(i
,
the
average includes
a
fixed
number of
and is
continuously updated
as new
are
taken).
Because the
output
interval
is s
than
the averaging period,
lnstruction
cannot be
used;the
algorithm
for
computing
t
the
user. T
is
average must be programmed by
following example demonstrates a
program
a runnrng average.
ln this
each
time a new measurement
case
a
thermocouple
is made
(in
an
average is computed for the
10
Input Location Labels:
1:PanlTemp
1S:Temp i-5
2:10smplav
16:Temp i-4
11:Temp
i-9
17:Temp i-3
12:Temp
i-8
18:Temp i-2
13:Temp
i-7
19:Temp
i-1
14:Temp
i-6
2O:Temp
i
Where
i is current reading,
i-l
is
previous reading, etc.
1
01:
10
most recent
samples. This
is
done by saving
all
10
temperalures
in
contiguous input locations
and using
t$e SpatialAverage lnstruction (51) to
compute th$
average.
The
temperatures are
stored
in lo(ations
11
through
20.
Each time
the
01:
P17
01:
1
P14
20
1
0
P51
10
11
2
02:
01:
02:
03:
o4:
05:
06:
07:
08:
03:
01:
02:
03:
Table 1 Programs
Sec. Execution lnterval
Panel
Temperature
Loc
[:PanlTemp]
Thermocouple Temp (DIFF)
Rep
5 mV slow Range
lN Chan
Type
T
(Copper-Constantan)
Ref
Temp Loc Panl Temp
Loc
[:Temp
i
]
Mult
Offset
SpatialAverage
Swath
First Loc
Temp i-9
Avg Loc [:1Osmplav]
table
is
exebuted,
the new measurement
is
stored in location 20 and
the average is stored
in
location
2.
The Block Move Instruction (5a)
is
then used
tO
move the
temperatures from
locations
12
through 20 down by one location;
the
oldest rneasurement (in location 11) is lost
when the
temperature from location
12 is
written
over
it.
8-1

Advertisement

Table of Contents
loading

Table of Contents