Rotation Instructions; Rotation Instructions; Right Rotation Of 16-Bit Data - Mitsubishi Electric MELSEC-Q/L Programming Manual

Hide thumbs Also See for MELSEC-Q/L:
Table of Contents

Advertisement

7.2

Rotation Instructions

Right rotation of 16-bit data

ROR(P), RCR(P)
High
Basic
Process
Redundant Universal
performance
ROR, RCR
RORP, RCRP
(D): Head number of the devices to rotate (BIN 16 bits)
n:
Number of rotations (0 to 15) (BIN 16 bits)
Setting
Internal device
data
Bit
Word
(D)
n
Processing details
■ROR
• Rotates 16-bit data of the device designated by (D), not including the carry flag, n-bits to the right. The carry flag is ON or
OFF depending on the status prior to the execution of the ROR instruction.
b15 b14 b13 b12 b11 b10 b9
D
0
0
0
0
0
0
0
b15 b14 b13 b12 b11 b10 b9
1
0
0
0
0
0
0
D
Value of b0
b15 b14 b13 b12 b11 b10 b9
0
1
0
0
0
0
0
D
Value of b0
b15 b14 b13 b12 b11 b10 b9
D
Value of b(n-1)
• When a bit device is designated for (D), a rotation is performed within the device range specified by digit specification. The
number of bits by which a rotation is executed is the remainder of n / (specified number of bits). For example, when n = 15
and (specified number of bits) = 12 bits, the remainder of 15 / 12 = 1 is "3", and the data is rotated 3 bits.
• Specify any of 0 to 15 as n. If the value specified as n is 16 or greater, the remainder of n / 16 is used for rotation. For
example, when n = 18, the contents are rotated two bits to the right since the remainder of 18 / 16 = 1 is "2".
LCPU
Command
Command
R, ZR
J\
Bit
b8
b7 b6 b5 b4 b3 b2 b1 b0
0
0
0
0
0
0
1
0
Right rotation (1 bit)
b7 b6 b5 b4 b3 b2 b1 b0
b8
0
0
0
0
0
0
0
1
Right rotation (1 bit)
b7 b6 b5 b4 b3 b2 b1 b0
b8
0
0
0
0
0
0
0
0
Right rotation (n bits)
b8
b7 b6 b5 b4 b3 b2 b1 b0
indicates an instruction symbol of ROR/RCR.
P
U\G
Word
Carry flag
(SM700)
1
0
Carry flag
(SM700)
0
1
Value of b0
Carry flag
(SM700)
1
0
Value of b0
Carry flag
(SM700)
Value of b(n-1)
D
n
D
n
Zn
Constant
Others
K, H
7 APPLICATION INSTRUCTIONS

7.2 Rotation Instructions

7
381

Advertisement

Table of Contents
loading

Table of Contents