6F3B0250
244
T1/T1S User’s Manual
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 size
n 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.
Pointer
D0200
100
0
D0201
10000
1
D0202
-1000
2
D0203
10
3
D0204
0
4
D0205
200
5
D0206
-300
6
D0207
20000
7
D0500
20000
(Maximum value)
D0208
-30
8
D0501
7
(Pointer)
D0209
20
9
Note
·
This instruction deals with the data as signed integer (-32768 to 32767).
·
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.
T1S only
CTi Automation - Phone: 800.894.0412 - Fax: 208.368.0415 - Web: www.ctiautomation.net - Email: [email protected]