13: BIT SHIFT / ROTATE INSTRUCTIONS
13-12 OPENNET CONTROLLER USER’S MANUAL
Examples: ROTRC
• Data Type: Word
• Data Type: Double Word
0
Before rotation: D20 = 13
0 0 0000 0 0 0 0 0100 1 1
CY
M8003
LSBMSB
D20
After first rotation: D20 = 6
Bits to rotate = 1
After second rotation: D20 = 32771
1010 0 0 100000 0 0 000
CY
M8003
LSBMSB
D20
0100 0 0 100000 0 0 001
CY
M8003
LSBMSB
D20
M8120
REP
M8120 is the initialize pulse special internal relay.
When the CPU starts operation, the MOV (move) instruction sets 13 to
data register D20.
Each time input I0 is turned on, 16-bit data of data register D20 is
rotated to the right by 1 bit as designated by operand bits.
The status of the LSB is set to a carry (special internal relay M8003),
and the carry status is set to the MSB.
SOTU
I0
S1 –
13
D1 –
D20
S1
D20
bits
1
ROTRC(W)
MOV(W)
Each time input I1 is turned on, 32-bit data of data registers D20 and
D21 is rotated to the right by 1 bit as designated by operand bits.
The status of the LSB is set to a carry (special internal relay M8003),
and the carry status is set to the MSB.
Bits to rotate = 1
SOTU
I1
S1
D20
bits
1
ROTRC(D)
Before rotation: D20·D21 = 851,981
After rotation: D20·D21 = 425,990
0110 0 1 000000 0 0 000
CY
M8003
LSBMSB
D20·D21
10 10 0 1 000000 0 0 000
CY
M8003
LSBMSB
D20·D21
Rotate to the right
1 10 0 1 000000 0 0 000
110 0 1 000000 0 0 000
Phone: 800.894.0412 - Fax: 888.723.4773 - Web: www.clrwtr.com - Email: info@clrwtr.com