USER’S MANUAL 13-1
13: BIT SHIFT / ROTATE INSTRUCTIONS
Introduction
Bit shift and rotate instructions are used to shift the 16-bit data in the data register designated by source operand S1 to the
left or right by the quantity of bits designated. The result is set to the data register designated by source operand S1 and a
carry (special internal relay M303). Since the bit shift and rotate instructions are executed in each scan while the input is
on, a level input or pulse input should be used as required.
51 SFTL (Shift Left)
Key Operation
Valid Operands (Standard Processing)
In the high-speed processing mode, data registers for this instruction are limited to D0 through D31.
Since the bit shift instructions are executed in each scan while input is on, a pulse input from an SOTU or SOTD instruc-
tion should be used as required.
Example: SFTL
Operand Function I Q M T C R D Constant Repeat
S1 (Source 1) Data for bit shift ——————0-99 — —
bit Quantity of bits to shift ——————— 1-15 —
SFTL S1
****
bit
**
CY ← S1
When input is on, 16-bit data of the data register designated by source operand S1 is
shifted to the left by the quantity of bits designated by operand bit. The result is set
to the data register, and the last bit status shifted out is set to a carry (special internal
relay M303). Zeros are set to the LSB.
0Before shift: 1 0 1010 1 0 1 1 1101 0 0
CY
M303
MSB LSB
S1
1After shift: 00 1010 1 0 1 1 1101 0 0
CY
M303
MSB LSB
S1
When bit to shift = 1
Shift to the left
ADV
1
BPS
2 S1
SFTL
( ) : 1bit
5
CC=
Enter operand S1 and the quantity of bits to shift.
Repeat cannot be designated for bit shift instructions.
To exit, press the key.
M301
SFTL
REP
**
M301 is the initialize pulse special internal relay.
When MICRO
3
starts operation, the MOV (move) instruction sets 43690 to
data register D10.
Each time input I0 is turned on, 16-bit data of data register D10 is shifted to
the left by 1 bit as designated by operand bit. The bit status shifted out is set
to a carry (special internal relay M303). Zeros are set to the LSB.
0Before shift: D10 = 43690 1 1 1000 1 0 1 1 1000 1 0
CY
M303
MSB LSB
D10
1After first shift: D10 = 21844 01 1000 1 0 1 1 1000 1 0
CY
M303
MSB LSB
D10
Bits to shift = 1
SOTU
I0
MOV
S1
43690
D1
D10
S1
D10
bit
1
0
00 0111 0 1 0 0 0111 0 00After second shift: D10 = 43688
CY
M303
MSB LSB
D10