![Mitsubishi Electric FX3G SERIES Programming Manual Download Page 293](http://html.mh-extra.com/html/mitsubishi-electric/fx3g-series/fx3g-series_programming-manual_238902293.webp)
291
FX
3G
/FX
3U
/FX
3UC
Series Programmable Controllers
Programming Manual - Basic & Applied Instruction Edition
10 Arithmetic and Logical Operation (
+
,
−
,
×
,
÷
) – FNC 20 to FNC 29
10.10 FNC 29 – NEG / Negation
1
Introdu
ction
2
Ov
ervi
ew
3
Instruction
Li
st
4
D
evices
in Det
ail
5
Specifi
ed the
De
vice
&
C
onst
ant
6
Bef
ore
Pr
og
ra
mmi
ng
7
Bas
ic
Instruction
8
FN
C00-FN
C0
9
Program Fl
ow
9
FNC
10-FN
C19
Mov
e & Com
pare
10
FNC
20-FNC
29
Arith. & Lo
gi
c
Operati
on
10.10 FNC 29 – NEG / Negation
Outline
This instruction obtains the complement of a numeric value (by inverting each bit and adding "1").
This instruction can be used to negate the sign of a numeric value.
→
For the Floating point negation ENEG (FNC128), refer to Section 18.16.
1. Instruction format
2. Set data
3. Applicable devices
Explanation of function and operation
1. 16-bit operation (NEG and NEGP)
Each bit of
is inverted (0
→
1, 1
→
0), "1" is added, and then the result is stored in the original device.
2. 32-bit operation (DNEG and DNEGP)
Each bit of [
+1,
] is inverted (0
→
1, 1
→
0), "1" is added, and then the result is stored in the original
device.
Caution
Note that the complement is obtained in every operation cycle in a continuous operation type instruction.
Operand type
Description
Data type
Word device number which stores data for obtaining complement and will store the
operation result (The operation result will be stored in the same word device number.)
16- or 32-bit binary
Oper-
and
Type
Bit Devices
Word Devices
Others
System User
Digit Specification
System User
Special
Unit
Index
Con-
stant
Real
Number
Charac-
ter String
Pointer
X Y M T C S D
.b KnX KnY KnM KnS T C D R U
\G
V Z Modify K H
E
"
"
P
3
3
3
3 3 3 3
3
3 3
3
DNEG
DNEGP
Mnemonic
Operation Condition
P
FNC 29
NEG
D
16-bit Instruction
3 steps NEG
NEGP
Mnemonic
Operation Condition
Continuous
Operation
Pulse (Single)
Operation
32-bit Instruction
5 steps
Continuous
Operation
Pulse (Single)
Operation
D
D
D
Command
input
FNC 29
NEGP
D
( )+1
→
D
D
D
D
Command
input
FNC 29
DNEGP
( + 1, ) +1 = ( + 1, )
D
D
D
D
D