OPENNET CONTROLLER USER’S MANUAL 13-1
13: BIT SHIFT / ROTATE INSTRUCTIONS
Introduction
Bit shift and rotate instructions are used to shift the 16- or 32-bit data in the designated source operand S1 to the left or
right by the quantity of bits designated. The result is set to the source operand S1 and a carry (special internal relay
M8003).
SFTL (Shift Left)
Valid Operands
For the valid operand number range, see page 6-2.
▲ Internal relays M0 through M2557 can be designated as S1. Special internal relays cannot be designated as S1.
The quantity of bits to shift can be 1 through 15 for the word data type, or 1 through 31 for the double-word data type.
Since the SFTL instruction is executed in each scan while input is on, a pulse input from a SOTU or SOTD instruction
should be used as required.
Valid Data Types
When a bit operand such as Q (output), M (internal relay), or R (shift register) is designated as the source, 16 points (word
data type) or 32 points (double-word data type) are used.
When a word operand such as D (data register) or L (link register) is designated as the source, 1 point (word data type) or
2 points (double-word data type) are used.
Operand Function I Q M R T C D L Constant Repeat
S1 (Source 1) Data for bit shift — X ▲ X —— XX ——
bits Quantity of bits to shift ————————1-15, 1-31 —
W (word) I (integer) D (double word) L (long)
X — X —
S1
*****
bits
**
CY ← S1
When input is on, 16- or 32-bit data of the designated source operand S1 is
shifted to the left by the quantity of bits designated by operand bits.
The result is set to the source operand S1, and the last bit status shifted out is set
to a carry (special internal relay M8003). Zeros are set to the LSB.
0Before shift: 1 0 1010 1 0 1 1 1101 0 0
CY
M8003
MSB LSB
S1
1After shift: 00 1010 1 0 1 1 1101 0 0
CY
M8003
MSB LSB
S1
Shift to the left
SFTL(*)
0
Before shift:
1 0 1010 1 0 1 1 1101 0 0
CY
M8003
MSB LSB
S1
1
After shift:
00 1010 1 0 1 1 1101 0 0
CY
M8003
MSB LSB
S1
Shift to the left
10 1010 1 0 1 1 1101 0 0
1 0 1010 1 0 1 1 1101 0 0
• Data Type: Word (bits to shift = 1)
• Data Type: Double Word (bits to shift = 1)
Phone: 800.894.0412 - Fax: 888.723.4773 - Web: www.clrwtr.com - Email: info@clrwtr.com