Subtracting 16-Bit Binary Data - Mitsubishi MELSEC iQ-F FX5 series Programming Manual

Melsec iq-f fx5 series
Hide thumbs Also See for MELSEC iQ-F FX5 series:
Table of Contents

Advertisement

Subtracting 16-bit binary data

-(P)(_U) instruction and SUB(P)(_U) instruction can be used for subtraction of 16-bit binary data.
-(P)(_U) [using two operands]
These instructions subtract the 16-bit binary data in the device specified by (d) and the 16-bit binary data in the device
specified by (s), and store the result in the device specified by (d).
Ladder diagram
(s)
(d)
Setting data
■Descriptions, ranges, and data types
Operand
Description
(s)
-(P)
Subtrahend data or the device where the data
to be subtracted from another is stored
-(P)_U
(d)
-(P)
Device where the data from which another is to
be subtracted is stored
-(P)_U
■Applicable devices
Operand
Bit
X, Y, M, L,
U\G T, ST,
SM, F, B, SB
(s)
(d)
Processing details
• These instructions subtract the 16-bit binary data in the device specified by (d) and the 16-bit binary data in the device
specified by (s), and store the subtraction result in the device specified by (d).
(d)
b15
···
b0
b15
1234 (BIN)
5678 (BIN)
-
• When underflow or overflow occurs in the operation result, the following processing is executed. In this case, the carry flag
(SM700, SM8022) does not turn ON.
In case of -(P)
K32768
-
K2
(8000H)
(0002H)
K32767
-
K-2
(7FFFH)
(FFFEH)
In case of -(P)(_U)
K0
-
K1
(0000H)
(0001H)
K0
-
K65535
(0000H)
(FFFFH)
Operation error
There is no operation error.
Word
T, ST, C, D,
C, LC
W, SD, SW, R
(s)
(d)
···
b0
b15
···
4444 (BIN)
Because the highest bit is 0, the value is positive.
K32766
(7FFEH)
K-32767
Because the highest bit is 1, the value is negative.
(8001H)
K65535
(FFFFH)
K1
(0001H)
Structured text
Not supported
Range
-32768 to +32767
0 to 65535
-32768 to +32767
0 to 65535
Double word Indirect
U\G
Z
LC
LZ
b0
Data type
Data type (label)
16-bit signed binary
ANY16_S
16-bit unsigned binary
ANY16_U
16-bit signed binary
ANY16_S
16-bit unsigned binary
ANY16_U
Constant
specification
K, H
E
$
6 BASIC INSTRUCTIONS
6.2 Arithmetic Operation Instructions
6
Others
165

Advertisement

Table of Contents
loading

Table of Contents