Instruction Parameters
Supported PLC Series
| PLC-AES | PLC-FB | PLC-ES |
|---|---|---|
| ✓ | ✓ | ✓ |
Supported Data Registers
| M | X | Y | K | L | F | T | C | S | Z | R | Q | D | @D | Constant | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| S1 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | – | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| S2 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | – | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
Supported Flags
| Flag | Bit | Support |
|---|---|---|
| Error | F11.0 | ✓ |
| Zero | F11.1 | – |
| Carry | F11.2 | – |
Number of Steps
| Steps |
|---|
| 3 |
Operands
| Operand | Description |
|---|---|
| S1 | The first operand. Entries are unsigned WORD data registers or constants. The unsigned value range is 0 ~ 65,535 (216-1). The Hexadecimal value range is H0000 ~ HFFFF. Only unsigned or Hexadecimal values will be compared. |
| S2 | The second operand. Entries are unsigned WORD data registers or constants. The unsigned value range is 0 ~ 65,535 (216-1). The Hexadecimal value range is H0000 ~ HFFFF. Only unsigned or Hexadecimal values will be compared. |
Notice
Error Flag (F11.0) Notice
The error flag, F11.0, will be ON for one scan when the address of the data register assigned by @D exceeds the range of the data register, D. The range of the data register, D, is dependent on the CPU type.
| Comparison | Operator | Flag | Comparison Range |
|---|---|---|---|
| Less Than | S1 \< S2 | F12.0 | 0 ~ 65,535 |
| Less Than Equal To | S1 ≤ S2 | F12.1 | 0 ~ 65,535 |
| Equal | S1 = S2 | F12.2 | 0 ~ 65,535 |
| Greater Than | S1 > S2 | F12.3 | 0 ~ 65,535 |
| Greater Than Equal To | S1 ≥ S2 | F12.4 | 0 ~ 65,535 |
| Not Equal | S1 ≠ S2 | F12.5 | 0 ~ 65,535 |
Comparison Flags
The UCMP instruction must be accompanied by a BOOL-type flag (F12.0 ~ F12.5). Please refer to each example on how to use the different flags.
Ladder Diagram Examples
Less Than (\<)
| Comparison | Operator | Flag | Comparison Range |
|---|---|---|---|
| Less Than | S1 \< S2 | F12.0 | 0 ~ 65,535 |
The UCMP instruction compares a WORD value, S1, to another WORD value, S2, and is true if S1 is less than S2. If S1 is less than S2, the BOOL flag F12.0 is true, and the output is energized.

If the contact, M0.0, is powered ON (1) and the expression, D40 < D42 (6,500 < 6,000) is FALSE, the less than flag, F12.0, is deenergized. As a result, the coil, Y0.0, is deenergized.

If the contact, M0.0, is powered ON (1) and the expression, D40 < D42 (5,500 < 6,000) is TRUE, the less than flag, F12.0, is energized. As a result, the coil, Y0.0, is energized.
Memory Monitor

Notice

One-Shot Warning
A rising-edge (one-shot) or falling-edge (one-shot) contact will NOT energize the output.
Less Than Equal To (≤)
| Comparison | Operator | Flag | Comparison Range |
|---|---|---|---|
| Less Than Equal To | S1 ≤ S2 | F12.1 | 0 ~ 65,535 |
The UCMP instruction compares a WORD value, S1, to another WORD value, S2, and is true if S1 is less than or equal to S2. If S1 is less than or equal to S2, the BOOL flag F12.1 is true, and the output is energized.

If the contact, M0.0, is powered ON (1) and the expression, D41 ≤ D43 (5,432 ≤ 4,321) is FALSE, the less than flag, F12.1, is deenergized. As a result, the coil, Y1.0, is deenergized.

If the contact, M0.0, is powered ON (1) and the expression, D41 ≤ D43 (54,321 ≤ 65,432) is TRUE, the less than flag, F12.1, is energized. As a result, the coil, Y1.0, is energized.
Memory Monitor

Notice

One-Shot Warning
A rising-edge (one-shot) or falling-edge (one-shot) contact will NOT energize the output.
Equal (=)
| Comparison | Operator | Flag | Comparison Range |
|---|---|---|---|
| Equal | S1 = S2 | F12.2 | 0 ~ 65,535 |
The UCMP instruction compares a WORD value, S1, to another WORD value, S2, and is true if S1 is equal to S2. If S1 is equal to S2, the BOOL flag F12.2 is true, and the output is energized.

If the contact, M0.0, is powered ON (1) and the expression, D50 ≠ D52 (12,542 ≠ 3,214) is FALSE, the less than flag, F12.2, is deenergized. As a result, the coil, Y2.0, is deenergized.

If the contact, M0.0, is powered ON (1) and the expression, D50 = D52 (12,345 = 12,345) is TRUE, the less than flag, F12.2, is energized. As a result, the coil, Y2.0, is energized.
Memory Monitor

Notice

One-Shot Warning
A rising-edge (one-shot) or falling-edge (one-shot) contact will NOT energize the output.
Greater Than (>)
| Comparison | Operator | Flag | Comparison Range |
|---|---|---|---|
| Greater Than | S1 > S2 | F12.3 | 0 ~ 65,535 |
The UCMP instruction compares a WORD value, S1, to another WORD value, S2, and is true if S1 is greater than S2. If S1 is greater than S2, the BOOL flag F12.3 is true, and the output is energized.
D60 (46,133 > 55,000) is FALSE, the less than flag, F12.3, is deenergized.”/>If the contact, M0.0, is powered ON (1) and the expression, D58 > D60 (46,133 > 55,000) is FALSE, the less than flag, F12.3, is deenergized. As a result, the coil, Y3.0, is deenergized.
D60 (59,000 > 55,000) is TRUE, the less than flag, F12.3, is energized.”/>If the contact, M0.0, is powered ON (1) and the expression, D58 > D60 (59,000 > 55,000) is TRUE, the less than flag, F12.3, is energized. As a result, the coil, Y3.0, is energized.
Memory Monitor

Notice

One-Shot Warning
A rising-edge (one-shot) or falling-edge (one-shot) contact will NOT energize the output.
Greater Than Equal To (≥)
| Comparison | Operator | Flag | Comparison Range |
|---|---|---|---|
| Greater Than Equal To | S1 ≥ S2 | F12.4 | 0 ~ 65,535 |
The UCMP instruction compares a WORD value, S1, to another WORD value, S2, and is true if S1 is greater than or equal to S2. If S1 is greater than or equal to S2, the BOOL flag F12.4 is true, and the output is energized.

If the contact, M0.0, is powered ON (1) and the expression, D66 ≥ D68 (8,463 ≥ 10,532) is FALSE, the less than flag, F12.4, is deenergized. As a result, the coil, Y4.0, is deenergized.

If the contact, M0.0, is powered ON (1) and the expression, D66 ≥ D68 (15,555 ≥ 10,532) is TRUE, the less than flag, F12.4, is energized. As a result, the coil, Y4.0, is energized.
Memory Monitor

Notice

One-Shot Warning
A rising-edge (one-shot) or falling-edge (one-shot) contact will NOT energize the output.
Not Equal (≠)
| Comparison | Operator | Flag | Comparison Range |
|---|---|---|---|
| Not Equal | S1 ≠ S2 | F12.5 | 0 ~ 65,535 |
The UCMP instruction compares a WORD value, S1, to another WORD value, S2, and is true if S1 is not equal to S2. If S1 is not equal to S2, the BOOL flag F12.5 is true, and the output is energized.

If the contact, M0.0, is powered ON (1) and the expression, D74 = D76 (54,321 = 54,321) is FALSE, the less than flag, F12.5, is deenergized. As a result, the coil, Y5.0, is deenergized.

If the contact, M0.0, is powered ON (1) and the expression, D74 ≠ D76 (45,612 ≠ 54,321) is TRUE, the less than flag, F12.5, is energized. As a result, the coil, Y5.0, is energized.
Memory Monitor

Notice

One-Shot Warning
A rising-edge (one-shot) or falling-edge (one-shot) contact will NOT energize the output.
