Skip to main content

Unsigned Comparison (WORD)

Instruction Parameters​

Supported PLC Series​

XPnA/1RXPnBXPnEXPnFCP3A/B/P/U
CP4A~D/U
CPnECPnFBPPLC-S
✓✓✓✓✓✓✓✓✓

Supported Data Registers​

MXYKLFTCSZRQD@DConstant
S1✓✓✓✓✓✓✓✓-✓✓✓✓✓✓
S2✓✓✓✓✓✓✓✓-✓✓✓✓✓✓

Supported Flags​

FlagBitSupport
ErrorF11.0✓
ZeroF11.1-
CarryF11.2-

Number of Steps​

Steps
3

Operands​

OperandDescription
S1The 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.
S2The 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.

ComparisonOperatorFlagComparison Range
Less ThanS1 < S2F12.00 ~ 65,535
Less Than Equal ToS1 ≤ S2F12.10 ~ 65,535
EqualS1 = S2F12.20 ~ 65,535
Greater ThanS1 > S2F12.30 ~ 65,535
Greater Than Equal ToS1 ≥ S2F12.40 ~ 65,535
Not EqualS1 ≠ S2F12.50 ~ 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.

Examples​