beautypg.com

Delta Electronics Programmable Logic Controller DVP-PLC User Manual

Page 468

background image

8 Application Instructions API 100-149

DVP-PLC Application Manual

8-66

API Mnemonic

Operands

Function

147

D SWAP P

Byte Swap

Controllers

ES/EX/SS SA/SX/SC EH/SV

Bit Devices

Word Devices

Program Steps

Type

OP

X Y M S K H

KnX

KnY KnM KnS T

C

D

E

F

S

*

*

*

*

*

*

*

*

SWAP, SWAPP: 3 steps
DSWAP, DSWAPP: 5 steps

PULSE 16-bit 32-bit

ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV

Operands:

S

: Device for swapping 8 high/low byte.

Explanations:

1. If

D

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

2. See the specifications of each model for their range of use.

3. As 16-bit instruction: the contents in the 8 high bytes and 8 low bytes are swapped.

4. As 32-bit instruction: the 8 high bytes and 8 low bytes in the two registers swap with each other respectively.

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

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

D10

D11

High Byte

High Byte

Low Byte

Low Byte