Shift Instructions; Shift Instructions; N-Bit Shift To Right Of 16-Bit Data, N-Bit Shift To Left Of 16-Bit Data - Mitsubishi Electric MELSEC-Q/L Programming Manual

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

Advertisement

7.3

Shift Instructions

n-bit shift to right of 16-bit data, n-bit shift to left of 16-bit data

SFR(P), SFL(P)
High
Basic
Process
Redundant Universal
performance
SFR, SFL
SFRP, SFLP
(D): Head number of the devices where shift data is stored (BIN 16 bits)
n:
Number of shifts (0 to 15) (BIN 16 bits)
Setting
Internal device
data
Bit
Word
(D)
n
Processing details
■SFR
• Causes a shift to the right by n bits of the 16-bit data from the device designated at (D). The n bits from the upper bit are
filled with 0s.
b15
b14 b13 b12 b11b10 b9
D
1
1
1
0
1
1
1
When n=6:
b15
b14 b13 b12 b11b10 b9
0
0
0
0
0
0
1
D
Filled with 0s.
• When a bit device is designated for (D), a right shift is executed within the device range specified by digit specification. The
number of bits by which a shift is executed is the remainder of n / (specified number of bits). For example, when n = 15 and
(specified number of bits) = 8 bits, the remainder of 15 / 8 = 1 is "7", and the data is shifted 7 bits.
Y1B
Y18
Y17
Y14 Y13
1
0
1
0
1
0
1
When n = 4:
Y1B
Y18
Y17
Y14 Y13
0
0
0
0
1
0
1
Filled with 0s.
• 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 a shift to the right.
For example, when n = 18, the data is shifted 2 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
0
1
1
1
0
1
1
1
b8
b7
b6 b5 b4 b3 b2 b1
1
1
0
1
1
1
0
1
Y10
0
1
0
1
0
Carry flag
(SM700)
Y10
0
1
0
1
0
indicates an instruction symbol of SFR/SFL.
P
U\G
Word
b0
0
Carry flag
(SM700)
b0
1
1
1
D
n
D
n
Zn
Constant
Others
K, H
7 APPLICATION INSTRUCTIONS

7.3 Shift Instructions

7
391

Advertisement

Table of Contents
loading

Table of Contents