DVP - ES2/EX2/SS2/SA2/SX2/SE Operation Manual - Programming

API

Mnemonic

Operands

Function

Controllers

147

D

SWAP

P

 

 

 

 

Byte swap

 

 

 

ES2/EX2

SS2 SA2 SX2

 

 

 

 

 

 

 

 

 

SE

 

 

Type

Bit Devices

 

 

Word devices

 

 

 

 

 

Program Steps

 

OP

 

X

Y

M

S

K

H KnX KnY KnM KnS T

C

D

E

F

SWAP, SWAPP: 3 steps

 

S

 

 

 

 

 

*

*

*

*

*

*

*

*

DSWAP, DSWAPP: 5

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

steps

 

 

 

 

 

 

 

 

 

 

PULSE

 

 

 

16-bit

 

 

 

32-bit

 

 

 

 

 

 

 

 

 

 

SA2

 

 

 

 

SA2

 

SA2

 

 

 

 

 

 

 

 

ES2/EX2 SS2

SE

SX2 ES2/EX2 SS2

SE

 

SX2 ES2/EX2 SS2 SE

SX2

Operands:

S: Device for byte swap.

Explanations:

1.For 16-bit instruction, high byte and low byte of the register will be swapped.

2.For 32-bit instruction, byte swap is conducted on the 2 registers separately.

3.This instruction adopts pulse execution instructions (SWAPP, DSWAPP)

4.If operand D uses device F, only 16-bit instruction is available

Program Example 1:

When X0 = ON, high byte and low byte of D0 will be swapped.

X0

SWAPP D0

D0

High Byte Low Byte

Program Example 2:

When X0 = ON, high byte and low byte of D11 will be swapped as well as the high byte and low byte of D10.

X0

 

 

 

 

 

DSWAP

D10

 

 

 

 

 

 

 

D11

D10

 

 

 

High Byte Low Byte

High Byte Low Byte

3 - 328

Page 444
Image 444
Delta DVP-ES2/EX2/SS2/SA2/SX2/SE manual Swap, DSWAP, Dswapp