beautypg.com

Swap – Delta Electronics Extension Digital I/O Module DOP-EXIO14RAE User Manual

Page 151

background image

Appendix D Use of Application Instructions|DOP-EXIO Series

D-70

Revision March, 2008, Doc. Name: 2007PDD23000014

Mnemonic

Operands Function

SWAP

D

S

Byte Swap

Bit Devices

Word Devices

X Y M S K H

KnX

KnY

KnM KnS

T

C

D

E

F

S

y

Note:

1. If D is used in device F, only 16-bit instruction is applicable.

16-bit instruction(5 Steps)

SWAP

Continuous
execution

32-bit instruction (9 Steps)

DSWAP

Continuous
execution

y

Flags: None

Operands:

S

: Device for swapping 8 high/low byte.

Explanations:
1. As 16-bit instruction: the contents in the 8 high bytes and 8 low bytes are swapped.
2. As 32-bit instruction: the 8 high bytes and 8 low bytes in the two registers swap with each other

respectively.

Program Example 1:
When X0 = On, the high 8 bytes and low 8 bytes in D0 will swap with each other.

D0

SWAPP

X0

D0

High Byte

Low Byte

Program Example 2:
When X0 = On, the high 8 bytes and low 8 bytes in D11 will swap with each other and the high 8 bytes
and low 8 bytes in D10 will swap with each other.

X0

DSWAPP

D10