FC6A S
ERIES
MICROS
MART
L
ADDER
P
ROGRAMMING
M
ANUAL
FC9Y-B1726 10-23
10: D
ATA
C
ONVERSION
I
NSTRUCTIONS
SWAP (Data Swap)
Valid Devices
For valid device address ranges, see "Device Addresses" on page 2-1.
Since the SWAP instruction is executed in each scan while input is on, a pulse input from a SOTU or SOTD instruction should be used.
Valid Data Types
Examples: SWAP
•Data Type: W (word)
When input I0 is turned on, upper- and lower-byte data of the 16-bit data in data register D10 assigned by source device S1 are exchanged, and the
result is stored to data register D20 assigned by destination device D1.
• Data Type: D (double-word)
When input I1 is turned on, upper- and lower-word data of the 32-bit data in data registers D10 and D11 assigned by source device S1 are
exchanged, and the result is stored to data registers D20 and D21 assigned by destination device D1.
S1 → D1
When input is on, upper and lower byte- or word-data of a word- or double-word-data
assigned by S1 are exchanged, and the result is stored to destination assigned by D1.
REP
**
S1(R)
*****
D1(R)
*****
SWAP(*)
Device Function I Q M R T C D P Constant Repeat
S1 (Source 1) Binary data to swap ——————X — — 1-99
D1 (Destination 1) Destination to store conversion result — — — — — — X — — 1-99
W (word) X When a D (data register) is assigned as the source or destination, 1 point (word data) or 2 points (double-word
data) are used. When repeat is assigned, the quantity of device words increases in 1- or 2-point increments.
I (integer) —
D (double word) X
L (long) —
F (float) —
I0
REPS1
D10
D1
D20
SWAP(W)
14640
D20
(3930h)
Before Execution
12345
D10
(3039h)
After Execution
I1
REPS1
D10
D1
D20
SWAP(D)
200
D11
100
D10
Before Execution After Execution
100
D21
200
D20