288
FX3G/FX3U/FX3UC 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
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
XYMTCSD.b KnX KnY KnM KnS T C D R U\G VZModifyKH E ""P
3333333 3 333
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