Shift And Rotate - Siemens SIMATIC S7 System Manual

Hide thumbs Also See for SIMATIC S7:
Table of Contents

Advertisement

7.14

Shift and rotate

7.14.1
Shift and rotate
Shift instructions (only the byte size LAD box is illustrated, the others are similar)
LAD / FBD
STL
SLB OUT,
N
SRB OUT,
N
SLW OUT,
SHL_W
N
SHR_W
SRW OUT,
N
SLD OUT,
SHL_DW
N
SHR_DW
SRD OUT,
N
Non-fatal errors with ENO=0
0006H Indirect address
Input / out-
Data type
put
IN
BYTE
WORD
DWORD
OUT
BYTE
WORD
DWORD
N
BYTE
S7-200 SMART
System Manual, V2.3, 07/2017, A5E03822230-AF
Shift type
Description
Shift left byte
The shift instructions shift the bit values of input value IN right or left by
the bit position shift count N and load the result in the memory location
assigned to OUT.
The shift instructions fill empty bit positions with zero as each bit is shift-
ed out. If the shift count N is greater than or equal to the maximum al-
lowed (8 for byte operations, 16 for word operations, and 32 for double
word operations), the value is shifted the maximum number of times for
Shift right byte
the operation. If the shift count is greater than 0, the overflow memory bit
SM1.1 is set to the value of the last bit shifted out. The SM1.0 zero
memory bit is set if the result of the shift operation is zero.
Byte operations are unsigned. For word and double word operations, the
sign bit is shifted when you use signed data values.
Shift left word
Shift right word
Shift left double
word
Shift right double
word
SM bits affected
SM1.0 Result of operation = zero
SM1.1 Overflow (last bit shifted out)
Operand
IB, QB, VB, MB, SMB, SB, LB, AC, *VD, *LD, *AC, Constant
IW, QW, VW, MW, SMW, SW, T, C, LW, AC, AIW, *VD, *LD, *AC, Constant
ID, QD, VD, MD, SMD, SD, LD, AC, HC, *VD, *LD, *AC, Constant
IB, QB, VB, MB, SMB, SB, LB, AC, *VD, *LD, *AC
IW, QW, VW, MW, SMW, SW, T, C, LW, AC, *VD, *LD, *AC
ID, QD, VD, MD, SMD, SD, LD, AC, *VD, *LD, *AC
IB, QB, VB, MB, SMB, SB, LB, AC, *VD, *LD, *AC, Constant
Program instructions
7.14 Shift and rotate
357

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Simatic s7-200 smart

Table of Contents