Neg - Omron SYSMAC CP Series Instruction & Reference Manual

Cpu unit
Hide thumbs Also See for SYSMAC CP Series:
Table of Contents

Advertisement

NEG

Instruction
2'S COMPLEMENT
Symbol
Applicable Program Areas
Area
Step program areas
Usage
OK
Operands
Operand
S
Source word
R
Result word
Operand Specifications
Area
CIO
WR
HR
S
OK
OK
OK
R
Flags
Name
Error Flag
Equals Flag
Negative Flag
Function
NEG
NEG(160) calculates the 2's complement of S and writes the result
to R. The 2's complement calculation basically reverses the status of
the bits in S and adds 1.
Note The result for 8000 hex will be 8000 hex.
Hint
• This operation (reversing the status of the bits and adding 1) is equivalent to subtracting the content
of S/S+1 and S from 0000/0000 0000.
CP1E CPU Unit Instructions Reference Manual(W483)
Mnemonic
Variations
NEG
@NEG
Description
Word addresses
AR
T
C
DM
OK
OK
OK
OK
Label
P_ER
OFF
P_EQ
• ON if the result is 0000/0000 0000.
• OFF in all other cases.
P_N
• ON if bit 15 of the result is ON.
• OFF in all other cases.
Function
code
Calculates the 2's complement of a word of hexa-
160
decimal data.
NEG
NEG(160)
S: Source word
S
R: Result word
R
Subroutines
OK
Data type
WORD
UINT
Indirect DM addresses
Constants
@DM
*DM
OK
OK
OK
---
Operation
2 Instructions
Function
Interrupt tasks
OK
Size
1
1
CF
Pulse bits
TR bits
---
---
---
2's complement
(Complement + 1)
(S)
(R)
2-189
2

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents