MAX

MAX, MAXP, DMAX, DMAXP

 
MAX instruction searches the maximum value from the source and saves the maximum value, the position number of the maximum value, and the total number of the maximum value to the Destination (assigned device address).

  • DMAX and DMAXP are double words.

 

 

S

Source

D

Destination

n

Number of data block to search

 

Instruction

Device address

No. of Steps

Flag

M

X

Y

K

L

F

T

C

S

Z

D

@D

Int.

 

Error

Zero

Carry

MAX

MAXP

DMAX

DMAXP

S

o

o

o

o

o

o

o

o

-

o

o

o

-

4

o

-

-

D

o

-

o

o

o

-

o

o

-

o

o

o

-

n

o

o

o

o

o

o

o

o

-

o

o

o

-

 

MAX

Functions

  • MAX(P) searches the maximum value from the 16 bit data source and saves the maximum value (6575) to D, the position number of the maximum value 2 (S+1, 2nd block from S) to D+1, and the total number of the maximum value (2) to D+2.

 

 

 

Example)

If X01 is ON, MAX instruction searches maximum values from D10 to D13 (4 blocks) and saves the maximum value 5563 to D200, the position number 2 (D11, 2nd block from D10) where the maximum number is located to D201, and the total number of the maximum value 1 to D202.

 

 

DMAX

Functions

  • DMAX(P) searches the maximum value from the 32 bit data source and saves the maximum value (46837444) to D and D+1, the position number of the maximum value (1) to D+2, and the total number of the maximum value (2) to D+3.

 

 

Example)

If X01 is ON, DMAX instruction searches maximum values from D0 to D7 (4 blocks) and save the maximum value 64846463 to D100 and D101, position number 3 (D4 and D5, 3rd block from D0) where the maximum number is located to D102, and the total number of the maximum value 1 to D103.