8-1
SECTION 8. PROCESSING AND PROGRAM CONTROL EXAMPLES
The following examples are intended to illustrate the use of Processing and Program Control
Instructions, flags, dual Final Storage, and the capability to direct the results of Output Processing
Instructions to Input Storage.
The specific examples may not be as important as some of the techniques employed, for example:
Directing Output Processing to Input Storage is used in the Running Average and Rainfall Intensity
examples (8.1 and 8.2).
Flag tests are used in the Running Average, Interrupt Subroutine, Converting Wind Direction, and
Saving Data Prior to Event examples (8.1, 8.5, 8.7 and 8.8).
Control ports and the Loop are illustrated in the AM32 example (8.3).
An algorithm for a down counter is used in the Saving Data Prior to Event example (8.8).
Powering 12 V sensors with the switched 12 V port (8.12).
As in Section 7 these examples are not complete programs to be taken verbatim. They need to be
altered to fit specific needs.
8.1 COMPUTATION OF RUNNING
MAXIMUM
It is sometimes necessary to compute a running
maximum (i.e., the maximum covers a fixed
number of samples and is continuously updated
as new samples are taken). Because the
output interval is shorter than the period over
which the maximum is determined, Instruction
71 cannot be used; the algorithm for computing
this maximum must be programmed by the
user. The following example demonstrates a
program for computing a running maximum.
In this example, each time a new measurement
is made (in this case a thermocouple
temperature) a maximum is determined and
computed for the 10 most recent samples. This
is done by saving all 10 temperatures in
contiguous input locations and using the Spatial
Maximum Instruction (49) to determine the
maximum. The temperatures are stored in
locations 11 through 20. Each time the table is
executed, the new measurement is stored in
location 20 and the maximum is stored in
location 2. The Block Move Instruction (54) is
then used to move the temperatures from
locations 12 through 20 down by 1 location; the
oldest measurement (in location 11) is lost
when the temperature from location 12 is
written over it.
PROGRAM
*
Table 1 Program
01:
10.0
Execution Interval (seconds)
01:
Panel Temperature (P17)
1:
1
Loc [ Panl_Temp ]
02:
Thermocouple Temp (DIFF) (P14)
1:
1
Reps
2:
1
±10 mV Slow Range
3:
1
DIFF Channel
4:
1
Type T (Copper-Constantan)
5:
1
Ref Temp Loc [ Panl_Temp ]
6: 20
Loc [ Temp_i ]
7:
1
Mult
8:
0
Offset
03:
Spatial Maximum (P49)
1: 10
Swath
2: 11
First Loc [ Temp_i_9 ]
3:
2
Avg Loc [ 10smpl_av ]
04:
Block Move (P54)
1:
9
No. of Values
2: 12
First Source Loc [ Temp_i_8 ]
3:
1
Source Step
4: 11
First Destination Loc [ Temp_i_9 ]
5:
1
Destination Step
05:
Do (P86)
1: 10
Set Output Flag High
Содержание CR23X
Страница 8: ...CR23X TABLE OF CONTENTS vi This is a blank page ...
Страница 12: ...CR23X MICROLOGGER OVERVIEW OV 2 1 2 3 A 4 5 6 B 7 8 9 C 0 D FIGURE OV1 1 CR23X Micrologger ...
Страница 34: ...CR23X MICROLOGGER OVERVIEW OV 24 This is a blank page ...
Страница 50: ...SECTION 1 FUNCTIONAL MODES 1 16 This is a blank page ...
Страница 72: ...SECTION 4 EXTERNAL STORAGE PERIPHERALS 4 8 This is a blank page ...
Страница 88: ...SECTION 6 9 PIN SERIAL INPUT OUTPUT 6 10 This is a blank page ...
Страница 103: ...SECTION 7 MEASUREMENT PROGRAMMING EXAMPLES 7 15 CR23X AVW1 FIGURE 7 15 2 Well Monitoring Example ...
Страница 110: ...SECTION 7 MEASUREMENT PROGRAMMING EXAMPLES 7 22 This is a blank page ...
Страница 134: ...SECTION 8 PROCESSING AND PROGRAM CONTROL EXAMPLES 8 24 This is a blank page ...
Страница 164: ...SECTION 9 INPUT OUTPUT INSTRUCTIONS 9 30 This is a blankpage ...
Страница 188: ...SECTION 11 OUTPUT PROCESSING INSTRUCTIONS 11 8 This is a blankp age ...
Страница 221: ...SECTION 13 CR23X MEASUREMENTS 13 21 FIGURE 13 5 1 Circuits Used with Instructions 4 9 ...
Страница 229: ...14 3 1 2 3 A 4 5 6 B 7 8 9 C 0 D FIGURE 14 3 1 CR23X Battery Pack and Panel ...
Страница 239: ...SECTION 14 INSTALLATION AND MAINTENANCE 14 13 S A N Y O FIGURE 14 11 6 Removal of band clamp and battery ...
Страница 240: ...SECTION 14 INSTALLATION AND MAINTENANCE 14 14 This is a blank page ...
Страница 244: ...APPENDIX A GLOSSARY A 4 This is a blank page ...
Страница 268: ...APPENDIX B CONTROL PORT SERIAL I O INSTRUCTION 15 B 24 This is a blank page ...
Страница 276: ...APPENDIX C BINARY TELECOMMUNICATIONS C 8 This is a blank page ...
Страница 278: ...This is a blank page ...
Страница 282: ...APPENDIX F DYNAGAGE SAP FLOW P67 F 4 This is a blank page ...
Страница 299: ...APPENDIX I TD OPERATING SYSTEM ADDENDUM FOR CR510 CR10X AND CR23X MANUALS ...
Страница 300: ...This is a blank page ...
Страница 302: ...This is a blank page ...
Страница 308: ...TABLE DATA ADDENDUM AD 6 This is a blank page ...
Страница 324: ...TD ADDENDUM SECTION 1 FUNCTIONAL MODES AD 1 8 This is a blank page ...
Страница 340: ...TD ADDENDUM SECTION 8 PROCESSING AND PROGRAM CONTROL EXAMPLES AD 8 10 This is a blank page ...
Страница 342: ...This is a blank page ...
Страница 373: ...This is a blank page ...