7-90
MAX(P),DMAX(P)
DMAX
(1) Searches in the n points of 32-bit BIN data, from the device designated by , for the
maximum value and stores the searched maximum value at the device designated by
and +1.
Starts the search from the device designated by and stores the location, specified in the
number of points counted from , of the device where the maximum value is found first at
+2 and stores the number of the found minimum values at +3.
Operation Error
(1) In any of the following cases, an operation error occurs, the error flag (SM0) turns ON, and
an error code is stored into SD0.
• The n-bit range from the , or device exceeds the range of that device.
(Error code: 4101)
• The device specified by exceeds the range of the corresponding device.
(For the Universal model QCPU only.) (Error code: 4101)
Program Example
(1) The following program subtracts, when X1C is turned ON, the data stored at D100 to D103
from the data stored at R0 to R3, and searches in the results of subtraction for the maximum
value, then, stores it at D200 to D202.
[Ladder Mode] [List Mode]
[Operation]
S
D
D
S
S
D D
S
S
D
D
D
S
S
S
1
2
54321000 (BIN)
4321000 (BIN)
3254000 (BIN)
54321000 (BIN)
12345678 (BIN)
n
54321000 (BIN)
Maximum value
Location
Quantity
D
S
S
S
S
S
+1,
+1,
+3,
+3
+5,
+7,
+9,
+2
+2
+4
+6
+8
S
D
Step
Instruction
Device
-679 (BIN)4321 (BIN)
D100
5432 (BIN)
4444 (BIN)
5000 (BIN)
D101
D102
D103
b0b15
R0
R1
R2
R3
b0b15
D150
D151
D152
D153
b0b15
1432
D200
2
1
D201
D202
Maximum value
Location
Quantity
4
D0
5000 (BIN)
4000 (BIN)
4000 (BIN)
6000 (BIN)
1432 (BIN)
444 (BIN)
-1000 (BIN)