Comparison instructions
604
Part III FP Instructions
F60_CMP
16-bit data compare
Instead of using this FP instruction, we recommend using the related IEC instruction of the
comparison instructions. Please refer also to Advantages of the IEC instructions in the online help.
Flags
Data Comparison
between s1 and s2
R900A
(>flag)
R900B
(=flag)
R900C
(<flag)
R9009
(carry-fl
ag)
s1<s2 Off Off On #
s1=s2 Off On Off Off
16-bit data
with sign
s1>s2 On Off Off #
s1<s2 # Off # On
s1=s2 Off On Off Off
16-bit data
without sign
s1>s2 # Off # Off
# turns ON or OFF depending on the conditions
This instruction also exists as a P instruction (for FP2/2SH, FP3/5, FP10/10SH PLC types), which
is only executed at the rising edge of the EN trigger. Select [Insert P instruction] from the
"Instructions" pane if you require a P instruction. To facilitate reuse, the instruction then appears
under "Recently used" in the pop-up menu. Press <Ctrl>+<Shift>+<v> within the programming
area to open the list of recently used elements.
PLC types
Availability of F60_CMP (see page 1325)
Variable Data type Function
s1, s2 ANY16 16-bit area or 16-bit equivalent constant to be compared
The variables s1 and s2 have to be of the same data type.
For Relay T/C Register Constant
s1, s2 WX WY WR WL SV EV DT LD FL dec. or hex.
Description
Compares the 16-bit data specified by s1 with one specified by s2 if the trigger EN is in the
ON-state. The compare operation result is stored in special internal relays R9009, R900A to
R900C.
Data types
Operands
Example
In this example the function has been programmed in ladder diagram (LD) and structured text
(ST).The same POU header is used for all programming languages.
POU header
All input and output variables used for programming this function have been declared in the POU
header.