Hitachi NJI-350B User Manual

Page 136

Advertising
background image

Chapter 5 Instruction Specifications

5-86

Item number

Application instructions-14

Name

Block exchange (EXCHANGE)

Ladder format

Condition code

Processing time (

µs)

Remark

R7F4

R7F3

R7F2

R7F1

R7F0

Average Maximum

XCG (d1, d2, n)

DER

ERR

SD

V

C

z

z

z

z

Instruction format

Number of steps

Condition

Steps

As per the table

below.

XCG (d1, d2, n)

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

o

nstant

Other

d1

Exchange destination
head I/O

{

{

d2 Exchange source head I/O

{

{

n

Number of bits (words)
to be exchanged

{

{

{

{

{

The constant is set in
decimal.

Function

• Exchanges the contents of the n bits from d1 to d1 + n - 1 and the contents between d2 and d2 + n - 1.
• Bits are exchanged with bits and words are exchanged with words.

d1+n-1

d2+n-1

d1

d2

n bits (words)

If n is a word:

The contents (0 to 255) of the lower 8 bits (b7 to b0) of n (WX, WY, WR, WM, TC) are set to the
number of bits (words) to be exchanged.

If n is a constant:

0 to 255 (decimal) can be designated for the number of bits (words) to be exchanged.

Notes

• Use this instruction so that d1 + n − 1 and d2 + n - 1 do not exceed the I/O range (R7BF, M3FFF, WRFFF, and WM3FF). If they

exceeds the I/O range, DER is equal to '1' and the exchange is performed up to the maximum range with respect to the smaller number of
bits (words) specified in d1 and d2.

• If n is equal to “0,” the block exchange is not performed and DER (R7F4) will be set to “0.”

Program example

X00001 DIF1

XCG (WM000, WM100, 256)

LD

X00001

AND DIF1

[

XCG (WM000, WM100, 256)

]

Program description

• When X00001 rises, the contents of WM000 to WM0FF are exchanged with the contents of WM100 to WM1FF.

X

C

G (d1,

d2,
n)

Processing time (

µs) (Average)

n

Bit

Word

1

139

120

16

338

159

32

528

207

64

918

284

128

1899

449

255

3695

779

Advertising