
6 BASIC INSTRUCTIONS
6.1 Comparison Operation Instructions
149
6
Comparison output 16-bit binary data
CMP(P)(_U)
These instructions perform a comparison operation between the 16-bit binary data in the devices specified by (s1) and (s2).
Setting data
■
Descriptions, ranges, and data types
■
Applicable devices
*1
T, ST, C cannot be used.
Processing details
• These instructions perform a comparison operation between the 16-bit binary data in the device specified by (s1) and the
16-bit binary data in the device specified by (s2) and according to the result (small, equal, large), (d), (d) + 1, or (d) + 2 is
turned ON.
• (s1) and (s2) are handled as binary values within the range of above data setting.
• Large and small comparison is executed algebraically.
Ladder diagram
Structured text
ENO:=CMP(EN,s1,s2,d);
ENO:=CMPP(EN,s1,s2,d);
ENO:=CMP_U(EN,s1,s2,d);
ENO:=CMPP_U(EN,s1,s2,d);
Operand
Description
Range
Data type
Data type (label)
(s1)
CMP(P)
Comparison value data or the device where the
comparison value data is stored
-32768 to +32767
16-bit signed binary
ANY16
CMP(P)_U
0 to 65535
16-bit unsigned binary
ANY16_U
(s2)
CMP(P)
Comparison source data or the device where
the comparison source data is stored
-32768 to +32767
16-bit signed binary
ANY16
CMP(P)_U
0 to 65535
16-bit unsigned binary
ANY16_U
(d)
The starting bit device to which the comparison
result is output
Bit
ANY_BOOL
Operand
Bit
Word
Double word
Indirect
specification
Constant
Others
X, Y, M, L,
SM, F, B, SB
U
\G
T, ST,
C, LC
T, ST, C, D,
W, SD, SW, R
U
\G
Z
LC
LZ
K, H
E
$
(s1)
(s2)
(d)
• With sign…
-10 (FFF6H) < 2 (0002H)
• Without sign…
32767 (7FFFH) < 65280 (FF00H)
(s1)
(s2)
(d)
(d)
CMP
48
49
50
51
(s1)
(s2)
(d)
(s2)
(d)
(s1)
(d)+1
(d)+2
(d)+1
(d)+2
Command input
Command input
Latched
Latched
Latched
Turns ON in the case of (s1)>(s2).
Turns ON in the case of (s1)=(s2).
Turns ON in the case of (s1)<(s2).
Even if the command input turns OFF and the CMP instruction is not executed, (d) to (d)+2 latches the status
just before the command input turns from ON to OFF.
Summary of Contents for MELSEC iQ-F FX5 series
Page 1: ...MELSEC iQ F FX5 Series Programming Manual Instructions Standard Functions Function Blocks ...
Page 2: ......
Page 21: ...19 PART 1 PART 1 OVERVIEW Part 1 consists of the following chapter 1 OVERVIEW ...
Page 98: ...96 4 STANDARD FUNCTIONS FUNCTION BLOCKS 4 2 Standard Function Blocks MEMO ...
Page 840: ...838 23 TIME DATA FUNCTIONS 23 4 Division MEMO ...
Page 887: ......