XCG (d1, d2, n)

Chapter 5 Instruction Specifications

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

 

 

 

 

As per the table

 

 

 

 

 

 

 

Condition

 

 

 

Steps

 

 

below.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

XCG (d1, d2, n)

 

 

 

 

 

 

 

 

 

 

 

 

 

4

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Bit

 

 

 

 

 

 

 

Word

 

Double word

Constant

 

 

 

Usable I/O

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Other

 

X

 

Y

M

 

 

CU, CT

 

WX

WY

WM

 

TC

DX

DY

DM

 

 

 

 

 

 

 

R,

 

 

TD, SS,

 

 

 

 

WR,

 

 

 

 

DR,

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

d1

Exchange destination

 

 

 

{

 

 

 

 

 

 

 

 

 

{

 

 

 

 

 

 

 

 

head I/O

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

d2

Exchange source head I/O

 

 

 

{

 

 

 

 

 

 

 

 

 

{

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

n

Number of bits (words)

 

 

 

 

 

 

 

 

 

{

{

 

{

 

{

 

 

 

{

 

The constant is set in

to be exchanged

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

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

n bits (words)

d1

 

d2+n-1

d2

 

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

 

 

LD

X00001

 

 

 

 

 

XCG (WM000, WM100, 256)

 

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.

n

Processing time (s) (Average)

Bit

Word

 

1

139

120

16

338

159

32

528

207

64

918

284

128

1899

449

255

3695

779

5-86

Page 136
Image 136
Hitachi NJI-350B manual Application instructions-14, Block exchange Exchange, R7F4 R7F3 R7F2 R7F1, XCG d1, d2, n