7-93
MIN(P),DMIN(P)
1
2
3
4
6
6
7
8
7.5 Data processing instructions
7.5.11 Minimum value search for 16- and 32-bit data (MIN(P),DMIN(P))
DMIN
(1) Searches in the n points of 32-bit BIN data, from the device designated by , for the
minimum value and stores searched minimum value at the devices 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 minimum 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 device specified by exceeds the range of the corresponding
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 adds, when X1C is turned ON, the data stored at D100 to D103 and
the data stored at R0 to R3, and searches in the results of addition for the minimum value,
then, stores it at D200 to D202.
[Ladder Mode] [List Mode]
[Operation]
S
D
D
S
S
D D
1
2
22342001 (BIN)
37282010 (BIN)
22342001 (BIN)
59872019 (BIN)
22342001 (BIN)
Minimum value
Location
Quantity
D
D
S
S
S
S
DD
+2
+4
+6
+1,
+2
+3
S
D
Step
Instruction
Device
5542 (BIN)
5857 (BIN)
4590 (BIN)
4450 (BIN)
R0
R1
R2
R3
D150
D151
D152
D153
9090
D200
3
1
D201
D202
Minimum value
Location
Quantity
4D0
5500 (BIN)
4000 (BIN)
4500 (BIN)
6000 (BIN)
11042 (BIN)
9857 (BIN)
9090 (BIN)
10450 (BIN)
D100
D101
D102
D103
b0b15
b0b15 b0b15
+