319
5-23 Special Math Instructions
The Special Math Instructions preform special arithmetic operations. MAX(165)
searches a range of words for the maximum value. MIN(166) searches a range
of words for the minimum value. SUM(167) adds a range of words. ROOT(140)
finds the square root of a value. FDIV(141) performs float-point division.
APR(142) finds the sine or cosine of an angle or extrapolates the Y value for a
given X value based on a table of coordinates.
5-23-1 FIND MAXIMUM: MAX(165)
Variations
j MAX(165)
(165)
MAX C R
1
D
R
1
: 1
st
word in range CIO, G, A, T, C, DM,
D: Destination word CIO, G, A, DM, DR, IR
C: Control word CIO, G, A, #, DM, DR, IR
Operand Data AreasLadder Symbol
When the execution condition is OFF, MAX(165) is not executed. When the ex-
ecution condition is ON, MAX(165) searches the range of memory from R
1
to
R
1
+N–1 for the address that contains the maximum value, outputs the maximum
value to the destination word (D) and, if bit 14 of C is ON, outputs the memory
address of the word containing the maximum value to IR0.
If bit 14 of C is ON and more than one address contains the same maximum val-
ue, the lowest of the addresses will be output to IR0.
The number of words within the range (N) is contained in the 3 rightmost digits of
C, which must be BCD between 001 and 999.
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. Refer to
3-2 Data Area Struc-
ture
for information on signed and unsigned binary data.
15 14 13 12 11 00
Output address to IR0
1 (ON): Yes.
0 (OFF): No.
Number of words
in range (N)
Not used – set to zero.
Data type
1 (ON): Signed binary
0 (OFF): Unsigned binary
C:
The 3 rightmost digits of C must be BCD between 001 and 999.
Note Refer to page 115 for general precautions on operand data areas.
Flags ER (A50003): The 3 rightmost digits of C are not BCD between 001 and 999.
Content of *DM word is not BCD when set for BCD.
EQ (A50006): The maximum value is zero.
N (A50008): Shows the status of bit 15 of the maximum value.
Description
Precautions
Special Math Instructions Section 5-23