6F3B0253
7. Instructions
FUN 162
MAX
Maximum value
Expression
Input − [ A MAX (n) B ]− Output
Function
When the input is ON, this instruction searches for the maximum value from the table of sizen words starting with A, and stores the maximum value in B and the pointer indicating the position of the maximum value in B+1. The allowable range of the table size n is 1 to 64.
Execution condition
Input |
| Operation | Output |
OFF | No execution |
| OFF |
ON | Execution |
| ON |
Operand
| Name |
|
| Device |
|
|
|
|
|
|
|
| Register |
|
|
|
| Constant | Index | ||
|
| X | Y | R | S | T. | C. | XW | YW | RW | SW | T | C | D | I | J | K |
|
| ||
A | Start of table |
|
|
|
|
|
| √ | √ | √ | √ |
| √ | √ | √ |
|
|
|
|
|
|
n | Table size |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 - 64 |
|
B | Result |
|
|
|
|
|
|
| √ |
| √ | √ | √ | √ | √ | √ | √ | √ |
|
|
|
Example
When R010 is ON, the maximum value is found from the register table D0200 to D0209 (10 words), and the maximum value is stored in D0500 and the pointer is stored in D0501.
D0200
D0201
D0202
D0203
D0204
D0205
D0206
D0207
D0208
D0209
100
10000
10
0
200
20000
20
Pointer
0
1
2
3
4
5
6
7
8
9
D0500
D0501
20000
7
(Maximum value) (Pointer)
Note
•This instruction deals with the data as signed integer
•If there are two or more maximum value in the table, the lowest pointer is stored.
•If Index register K is used as operand B, the pointer data is discarded.
226