Special Math Instructions
00000
7-23-4 AVERAGE VALUE – AVG(––)
Limitations
Description
476
value will be stored in DM 0500. The address of the word containing the mini-
mum value (0014) will be stored in DM 0501.
DM 0300
4010
3F2A
DM0010
51C3
DM0011
DM0012
E02A
DM0013
7C9F
DM0014
2A20
10 words
A827
DM0015
33BF
DM0016
E02A
DM0017
DM0018
2A20
94DC
DM0019
2A20
DM 0500
0014
DM 0501
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.
Address
Instruction
MIN(––)
00000
LD
DM 0300
00001
MIN(––)
DM 0000
DM 0500
Address of word containing maximum value: 0014
Minimum value
Minimum value
If there are two words containing
the minimum value, the one found
first will be stored in DM 0501.
Operand Data Areas
IR, SR, AR, DM, HR, TC, LR
IR, SR, AR, DM, HR, TC, LR, #
D: First destination word
IR, SR, AR, DM, HR, LR
Section
7-23
Operands
00000
DM
0300
DM
0000
DM
0500
S: Source word
N: Number of cycles
th
execution,
Need help?
Do you have a question about the CPM1 - PROGRAMING MANUAL 02-2001 and is the answer not in the manual?