Bswap ( Swaps Two Values In Byte Units) - Mitsubishi QD51 Programming Manual

Logic controller
Hide thumbs Also See for QD51:
Table of Contents

Advertisement

11 INSTRUCTIONS AND FUNCTIONS
BSWAP
Instruction
• Swaps two values in byte units.
BSWAP
Syntax
variable 1, variable 2
swap start address of
variable 1, variable 2
swap count
BSWAP A%( ), 0, A%( ), 1, 1
Examples
BSWAP A$, 2, B%( ), 1, 2
(0)
(1)
(2)
(3)
11 - 11
Byte SWAP
<variable 1> , <swap starting address of variable 1> ,
<variable 2> , <swap starting address of variable 2> , <swap count>
Before swap
A%
C8
H
(0)
00
H
64
H
(1)
00
H
Before swap
A$
B%
41
(A)
00
H
(0)
42
(B)
59
H
43
(C)
50
H
(1)
10
44
(D)
H
• • • •
Specify the variables to be swapped.
• • • •
Specify the swap start address of variable1 and
variable2.
• • • •
Specify the number of items to swap in byte units.
• • • •
Swaps the upper one byte and lower one byte of
A%(0).
After swap
(0)
(1)
• • • •
Swaps two bytes of character array A$(2), A$(3) and
other two bytes that are the upper one byte of the
integer array B%(0) and the lower one byte of B%(1).
A$
(0)
41
(A)
H
H
(1)
42
(B)
H
H
(2)
59
(Y)
H
H
(3)
50
(P)
H
H
MELSEC-Q
A%
00
Lower one byte
H
C8
Higher one byte
H
64
Lower one byte
H
00
Higher one byte
H
After swap
B%
00
H
(0)
43
H
44
H
(1)
10
H
Lower one byte
Higher one byte
Lower one byte
Higher one byte
11 - 11

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ad51h-s3Qd51-r24A1sd51s

Table of Contents