Omron CJ - REFERENCE MANUAL 10-2009 Reference Manual page 623

Table of Contents

Advertisement

Flags
Name
Error Flag
Equals Flag
Negative Flag
Function
MAXL(174) searches the range of memory from R1 to R1+(2W-1) for the maximum double word value
in the range and outputs that maximum value to D and D+1.
When bit 14 of C+1 has been set to 1, MAXL(174) writes the PLC memory address of the lower word of
the words containing the maximum value to IR0. (If two or more double words within the range contain
the same maximum value, the address of lower word of the first double word containing the maximum
value is written to IR0.)
When bit 15 of C+1 has been set to 1, MAXL treats the data within the range as signed binary data. (A
negative value is given as it's two's complement.)
Saving and Restoring Values in Index Registers
MAXL can be used to write the PLC memory address of the lower word of the words containing the
maximum value to IR0. If IR0 is being used for other purposes in other places in the program, be sure to
save and restore the contents of IR0 before and after MAXL. (This information applies to MAXF, MAXD,
MINL, MINF, and MIND as well. For MINL, MINF, and MIND, the PLC memory address of the lower
word of the minimum value would be written to IR0.)
CS/CJ/NSJ Series Instructions Reference Manual (W474)
Label
ER
• ON if the length of the table specified in C (bits 00 to 15) is not between 0001 and FFFF hex.
• OFF in all other cases.
=
• ON if the maximum value is 0.
• OFF in all other cases.
N
• ON if bit 15 of D+1 is ON.
• OFF in all other cases.
PLC memory address
R1
R1+1
Lower 16 bits of A
m
Upper 16 bits of A
R1+ (2W 1)
R1+ (2W 2)
0.00
MOVL
Save the contents of IR00 in W510 and W511
before executing MAXL.
IR0
W510
MAXL
Store the first word of the maximum value in
IR0.
#40000004
D0
W0
MOVL
Copy the contents of IR00 (the result from MAXL) to
IR1.
IR0
IR1
MOVL
Restore the previous contents to IR0.
W510
IR0
Operation
C
W
W 2 words (W = bits 00 to 15 of C)
Lower 16 bits of A
D
D+1
Upper 16 bits of A
IR00
m
3. Instructions
3
585

Advertisement

Table of Contents
loading

Table of Contents