Average Value -- Avg - Omron CPM1 Programming Manual

Hide thumbs Also See for CPM1:
Table of Contents

Advertisement

Caution
!
Flags
7-22-3 AVERAGE VALUE - - AVG(- - - -)
Limitations
Description
When bit 15 of C is OFF, data within the range is treated as unsigned binary and
when it is ON the data is treated as signed binary.
15
14
13
12
11
C:
Not used -- set to zero.
If bit 14 of C is ON, values above #8000 are treated as negative numbers, so the
results will differ depending on the specified data type. Be sure that the correct
data type is specified.
ER:
Indirectly addressed DM word is non-existent. (Content of
not BCD, or the DM area boundary has been exceeded.)
R
and R
+N--1 are not in the same data area.
1
1
EQ:
ON when the minimum value is #0000.
Ladder Symbols
AVG(----)
S
N
D
This instruction is available in the CPM2A/CPM2C only.
S must be hexadecimal.
N must be BCD from #0001 to #0064.
D and D+N+1 must be in the same data area.
DM 6144 to DM 6655 cannot be used for S, N, or D to D+N+1.
AVG(----) is used to calculate the average value of S over N cycles.
When the execution condition is OFF, AVG(----) is not executed.
Each time that AVG(----) is executed, the content of S is stored in words D+2 to
D+N+1. On the first execution, AVG(----) writes the content of S to D+2; on the
second execution it writes the content of S to D+3, etc. On the N
AVG(----) writes the content of S is stored in D+N+1, AVG(----) calculates the av-
erage value of the values stored in D+2 to D+N+1, and writes the average to D.
Section
00
Number of words
in range (N: 001 to 999 BCD)
Not used -- set to zero.
Output address to D+1?
1 (ON):
Yes.
0 (OFF): No.

DM word is
Operand Data Areas
S: Source word
IR, SR, AR, DM, HR, TC, LR
N: Number of cycles
IR, SR, AR, DM, HR, TC, LR, #
D: First destination word
IR, SR, AR, DM, HR, LR
th
execution,
7-22

Advertisement

Table of Contents
loading

This manual is also suitable for:

Srm-v2Cpm1aCpm2aSrm1Cpm2c

Table of Contents