Omron C200HE Computer Hardware User Manual


 
260
For the first N1 cycles when the execution condition is ON, AVG(––) writes the
value of S to D. Each time that AVG(––) is executed, the previous value of S is
stored in words D+2 to D+N+1. The first 2 digits of D+1 are incremented with
each execution and act as a pointer to indicate where the previous value is
stored. Bit 15 of D+1 remains OFF for the first N1 cycles.
On the N
th
cycle, the previous value of S is written to last word in the range D+2 to
D+N+1. The average value of the previous values stored in D+2 to D+N+1 is cal-
culated and written to D, bit 15 of D+1 is turned ON, and the previous value point-
er (the first 2 digits of D+1) is reset to zero. Each time that AVG(––) is executed,
the previous value of S overwrites the content of the word indicated by the point-
er and the new average value is calculated and written to D. The pointer will be
reset again after reaching N1.
The following diagram shows the function of words D to D+N+1.
D Average value (after N or more cycles)
D+1 Previous value pointer and cycle indicator
D+2 Previous value #1
D+3 Previous value #2
D+N+1 Previous value #N
The function of bits in D+1 are shown in the following diagram and explained in
more detail below.
15 14 08 07 00
Previous value pointer
(2-digit hexadecimal from 0 to N1.)
D+1:
Not used. Set to zero.
Cycle indicator
0 (OFF): cycles since execution of AVG(––) < N.
1 (ON): cycles since execution of AVG(––) N.
Previous Value Pointer The previous value pointer indicates the location where the most recent value of
S was stored relative to D+2, i.e., a pointer value of 0 indicates D+2, a value of 1
indicates D+3, etc.
Cycle Indicator The cycle indicator is turned ON after AVG(––) has been executed N times. At
this point, D will contain the average value of the contents of words D+2 through
D+N+1. The average value is 4-digit hexadecimal and is rounded off to the near-
est integer value.
Flags ER: Indirectly addressed DM word is non-existent. (Content of DM word is
not BCD, or the DM area boundary has been exceeded.)
One or more operands have been set incorrectly.
Special Math Instructions Section 5-21