Download Print this page

Exchanging The Upper And Lower Bytes Of 16-Bit Data - Mitsubishi Electric MELSEC iQ-F FX5 Programming Manual

Instructions, standard functions/function blocks
Hide thumbs Also See for MELSEC iQ-F FX5:

Advertisement

Exchanging the upper and lower bytes of 16-bit data

SWAP(P)
These instructions swap the value of 8 bits of the upper and lower bytes of the device specified by (d).
Ladder diagram
(d)
FBD/LD
EN
ENO
d
Setting data
■Descriptions, ranges, and data types
Operand
Description
(d)
Head device for storing the data to be swapped
EN
Execution condition
ENO
Execution result
■Applicable devices
Operand
Bit
X, Y, M, L, SM,
F, B, SB, S
(d)
Processing details
These instructions swap the value of 8 bits of the upper and lower bytes of the device specified by (d).
b15
b12
b11
b8
b7
∙∙∙
∙∙∙
∙∙∙
(d)
0
1
0
1
0
1
0
1
1
0
b15
b12
b11
b8
b7
∙∙∙
∙∙∙
∙∙∙
(d)
1
0
1
0
1
0
1
0
0
1
Precautions
If a continuous operation type instruction is used, swap is done in each operation cycle.
Operation error
There is no operation error.
7 BASIC INSTRUCTIONS
362
7.7 Data Transfer Instructions
Word
T, ST, C, D, W,
SD, SW, R
b4
b3
b0
∙∙∙
1
0
1
0
1
0
b4
b3
b0
∙∙∙
0
1
0
1
0
1
Structured text
ENO:=SWAP(EN,d);
ENO:=SWAPP(EN,d);
Range
Double word Indirect
U\G
Z
LC
Data type
16-bit signed binary
Bit
Bit
Constant
specification
LZ
K, H
Data type (label)
ANY16
BOOL
BOOL
Others
E
$

Hide quick links:

Advertisement

loading