7-57
SFTWR(P),SFTWL(P)
1
2
3
4
6
6
7
8
7.3 Shift instruction
7.3.5 n-bit shift to right or left of n-word data (SFTWR(P),SFTWL(P))
SFTWL(P)
(1) This instruction shifts the n1 words data in the devices starting from the device specified by
to the left by n2 words.
n1=9, n2=4
(2) The n2 words in the devices starting from the lowest device are filled with 0s.
(3) If the value specified by n1 or n2 is 0, the instruction will be not processed.
(4) If the value of n2 is equal to or greater than the value of n1, the n1 words devices starting
from the device specified by will be filled with 0s.
Operation Error
(1) In any of the following cases, an operation error occurs, the error flag (SM0) turns on, and an
error code is stored into SD0.
• n1 or n2 is negative value. (Error code: 4100)
• The range of devices specified by n1 exceeds the range of devices specified by .
(Error code: 4101)
Program Example
(1) The following program shifts the 8 words (n1) data stored in the devices starting from D10
specified by to the right by 2 words (n2), when M0 is turned on.
[Ladder Mode] [List Mode]
[Operation]
D
10 0 7FF 3A 1F 30 0 FF
Filled with 0H
2
1
D D
3
D
4
D
5
D
n2
6
D
7
D
8
D D
n1
2
1
D D
3
D
4
D
5
D
6
D
7
D
8
D D
1FF
HH H HH H HH
0
H
0
H
0
H
0
H
H
3A 1F 30 0 FF
HHHH H
D
D
D
Step
Instruction
Device
1FF 0 2A 7FF 10 4E
1FF 0 2A 7FF 10 4E
5F FF
D10D11D12D13D14D15D16D17
00
D10D11D12D13D14D15D16D17
HH
HH HHH HHH
HHHHHH
Filled with 0H