Item number
Application instructions-17
Ladder format
ABS (d, s)
Instruction format
ABS (d, s)
Usable I/O
I/O after absolute value is
d
taken
I/O before absolute value
s
is taken
Function
•
Given s is signed, set the absolute value of s in d.
•
If s is positive or 0: The content of s is set to d. C (R7F0) is set to "0."
•
If s is negative: Two's complements of the contents of s are set in d. C (R7F0) is set to "1."
•
Perform with d and s as both words or both double words.
Example:
R000
DIF0
(When the value of WM is positive or 0)
WM0000 = H4C1A
d
s
WM0000
0 1 0 0 1 1 0 0 0 0 0 1 1 0 1 0
s
WR0000
0 1 0 0 1 1 0 0 0 0 0 1 1 0 1 0
d
•
When s is a word:
•
When s is a double word:
Notes
•
Use edge trigger as the startup condition for this instruction.
Name
Condition code
R7F4
R7F3
R7F2
DER
ERR
SD
Number of steps
Condition
Word
Double word
Bit
R,
TD, SS,
X
Y
M
CU, CT
WX WY
ABS (WR0000, WM0000)
(When the value of WM is negative)
WM0000 = HCC1A
R7F0
0
WM0000
1 1 0 0 1 1 0 0 0 0 0 1 1 0 1 0
s
0 0 1 1 0 0 1 1 1 1 1 0 0 1 0 1
+
0
WR0000
0 0 1 1 0 0 1 1 1 1 1 0 0 1 1 0
d
0 to 32767 (decimal) correspond to H000 to H7FFF (hexadecimal).
−32768 to −1(decimal) correspond to H8000 to HFFFF (hexadecimal).
0 to 2147483647 (decimal) correspond to H00000000 to H7FFFFFFF (hexadecimal).
−2147483648 to −1 (decimal) correspond to H80000000 to HFFFFFFFF (hexadecimal).
5-89
Chapter 5 Instruction Specifications
Absolute value
Processing time (µs)
R7F1
R7F0
Average Maximum
V
C
30
↕
Steps
3
4
4
Word
Double word
WR,
WM TC DX DY
d
s+1
R7F0
0
1
1
Remark
Upper case: W
Lower case: DW
DR,
Other
DM