Maximum Value (WORD)
Instruction Parameters
Supported PLC Series
| XPnA/1R | XPnB | XPnE | XPnF | CP3A/B/P/U CP4A~D/U | CPnE | CPnF | BP | PLC-S |
|---|---|---|---|---|---|---|---|---|
| ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
Supported Data Registers
| M | X | Y | K | L | F | T | C | S | Z | R | Q | D | @D | Constant | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| S | ✓ | ✓ | ✓ | ✓ | ✓ | - | ✓ | ✓ | - | ✓ | - | ✓ | ✓ | ✓ | - |
| D | ✓ | - | ✓ | ✓ | ✓ | - | ✓ | ✓ | - | ✓ | - | ✓ | ✓ | ✓ | - |
| n | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
Supported Flags
| Flag | Bit | Support |
|---|---|---|
| Error | F11.0 | ✓ |
| Zero | F11.1 | - |
| Carry | F11.2 | - |
Number of Steps
| Steps |
|---|
| 4 |
Operands
| Operand | Description |
|---|---|
| S | The first operand. Entries are only WORD data registers. This is the starting register to find the largest possible number. The signed value range is -32,768 ~ 32,767 (216). The unsigned value range is 0 ~ 65,535 (216-1). The Hexadecimal value range is H0000 ~ HFFFF. |
| D | The second operand. Entries are only WORD data registers. This is where the maximum value found and its data register are saved. This requires 3 WORD data registers. |
| n | The third operand. Entries are WORD data registers or constants. This is the amount of data registers to search through starting at D. The value range is 1 ~ 32,767 (215-1). |
Notice
Error Flag (F11.0) Notice
Instruction Behavior
The MAX and MAXP instructions behave as follows:
- Both instructions require 3 data registers starting at the data register, D.
- D saves the maximum number found in the search range.
- D+1 saves the first occurrence index of the maximum number found in the search range.
- D+2 saves the amount of times the maximum number was found in the search range.
- If n is less than 1 or greater than 32,767, neither instruction will execute.