Hitachi NJI-350B User Manual

Page 139

Advertising
background image

Chapter 5 Instruction Specifications

5-89

Item number

Application instructions-17

Name

Absolute value

Ladder format

Condition code

Processing time (

µs)

Remark

R7F4

R7F3

R7F2

R7F1

R7F0

Average Maximum

ABS (d, s)

DER

ERR

SD

V

C

Upper case: W

z

z

z

z

30

Lower case: DW

Instruction format

Number of steps

Condition

Steps

ABS (d, s)

Word

3

4

Double word

4

Bit

Word

Double word

Usable I/O

X

Y

R,

M

TD, SS,

CU, CT

WX WY

WR,

WM TC DX DY

DR,

DM

C

onstant

Other

d

I/O after absolute value is
taken

{

{

{

{

s

I/O before absolute value
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.

ABS (WR0000, WM0000)

R000

DIF0

(When the value of WM is positive or 0)

WM0000 = H4C1A

0 1 0 0 1 1 0 0 0 0 0 1 1 0 1 0

WM0000

s

0

R7F0

d s

0 1 0 0 1 1 0 0 0 0 0 1 1 0 1 0

WR0000

d

0

(When the value of WM is negative)

WM0000 = HCC1A

1 1 0 0 1 1 0 0 0 0 0 1 1 0 1 0

WM0000

s

0

d s+1

R7F0

WR0000

d

1

0 0 1 1 0 0 1 1 1 1 1 0 0 1 0 1

0 0 1 1 0 0 1 1 1 1 1 0 0 1 1 0

1

+

Example:

• When s is a word:

0 to 32767 (decimal) correspond to H000 to H7FFF (hexadecimal).
−32768 to −1(decimal) correspond to H8000 to HFFFF (hexadecimal).

• When s is a double word:

0 to 2147483647 (decimal) correspond to H00000000 to H7FFFFFFF (hexadecimal).
−2147483648 to −1 (decimal) correspond to H80000000 to HFFFFFFFF (hexadecimal).

Notes

• Use edge trigger as the startup condition for this instruction.

AB

S (

d,

s)

Advertising