
CR10X Reference Manual
12-4
Instruction, not by indexing the input location within a loop. The reason for this is
that an Output Instruction within a loop is allocated the same number of
Intermediate Storage locations as it would receive if it were not in the loop. For
example, the Average instruction with a single repetition is allocated only two
Intermediate locations: one for the number of samples and one for the running
total. Each time through the loop the sample counter is incremented and the value
in the referenced input location is added to the total. If the input location is
indexed, the values from all input locations are added to the same total.
If the Average Instruction with one repetition and location 1 indexed is placed
within a loop of 10 and the Output Flag is set high before entering the loop, 10
values will be output. The first will be the average of all the readings in locations
1-10 since the previous output. Because the Intermediate locations are zeroed each
time an output occurs, the next nine values will be the current values (samples at
the time of output) of locations 2-10.
Loops can be nested. Indexed locations within nested loops are indexed to the
innermost loop that they are within. The maximum nesting level in the CR10X is
eleven deep. This applies to ‘If Then/Else’ comparisons and Loops or any
combination thereof. An ‘If Then/Else’ comparison which uses the Else
instruction (Instruction 94) counts as being nested two deep.
PARAM.DATA
NUMBER
TYPE
DESCRIPTION
01:
4
Delay
02:
4
Iteration count
Examples
The following example involves the use of the Loop instruction without a delay to
perform a block data transformation:
The user wants 1-hour averages of the vapour pressure calculated from the wet-
and dry-bulb temperatures of five psychrometers. One pressure transducer
measurement is also available for use in the vapour pressure calculation.
1.
The input locations are assigned as follows:
a)
pressure: Location 10
b)
dry-bulb temperatures: Locations 11-15
c)
wet-bulb temperatures: Locations 16-20
d)
calculated vapour pressure: Locations 16-20 (Vapour pressure is
written over the wet-bulb temperatures.)
2.
The program flow is as follows:
a)
Enter the Loop instruction (87) with Delay=0 and iteration count=5.
b)
Calculate the vapour pressure with Instruction 57 using a normal
location entry of 10 for atmospheric pressure and indexed locations of
11, 16 and 16 for the dry-bulb, wet-bulb, and calculated vapour
pressure, respectively.
c)
End the loop with Instruction 95.
d)
Use the If Time instruction (92) to set the Output Flag every hour.
e)
Use the Average instruction (71) with five repetitions starting at input
location 16 to average the vapour pressure over the hour.