EasyManua.ls Logo

Siemens Simatic S7 Series

Siemens Simatic S7 Series
726 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Program instructions
7.14 Shift and rotate
S7-200 SMART
316 System Manual, 09/2015, A5E03822230-AC
Rotate instructions (only the byte size LAD box is illustrated, the others are similar)
LAD / FBD
STL
Rotate type
Description
RLB OUT,
N
RRB OUT,
N
Rotate left byte
Rotate right byte
The rotate instructions rotate the bit values of input value IN right or left by
the bit position rotate count N and load the result in the memory location
assigned to OUT. The rotate operation is circular.
If the rotate count is greater than or equal to the maximum for the operation
(8 for a byte operation, 16 for a word operation, or 32 for a double-word
operation), the CPU performs a modulo operation on the rotate count to
obtain a valid shift count before the rotation is executed. This result is a shift
count of 0 to 7 for byte operations, 0 to 15 for word operations, and 0 to 31
for double-word operations.
If the rotate count is 0, a rotate operation is not performed. If the rotate oper-
ation is performed, the overflow bit SM1.1 is set to the value of the last bit
rotated out.
If the rotate count is not an integer multiple of 8 (for byte operations), 16 (for
word operations), or 32 (for double-word operations), the last bit value rotat-
ed out is copied to the overflow memory bit SM1.1. The zero memory bit
SM1.0 is set when the value to be rotated is zero.
Byte operations are unsigned. For word and double word operations, the
sign bit is rotated when you use signed data types.
ROL_W
ROR_W
RLW OUT,
N
RRW OUT,
N
Rotate left word
Rotate right
word
ROL_DW
ROR_DW
RLD OUT,
N
RRD OUT,
N
Rotate left dou-
ble word
Rotate right
double word
Non-fatal errors with ENO=0
SM bits affected
0006H Indirect address SM1.0 Result of operation = zero
SM1.1 Overflow (last bit shifted out)
Input / out-
put
Data type
Operand
IN
BYTE
IB, QB, VB, MB, SMB, SB, LB, AC, *VD, *LD, *AC, Constant
WORD
IW, QW, VW, MW, SMW, SW, T, C, LW, AC, AIW, *VD, *LD, *AC, Constant
DWORD
ID, QD, VD, MD, SMD, SD, LD, AC, HC, *VD, *LD, *AC, Constant
OUT
BYTE
IB, QB, VB, MB, SMB, SB, LB, AC, *VD, *LD, *AC
WORD
IW, QW, VW, MW, SMW, SW, T, C, LW, AC, *VD, *LD, *AC
DWORD
ID, QD, VD, MD, SMD, SD, LD, AC, *VD, *LD, *AC
N
BYTE
IB, QB, VB, MB, SMB, SB, LB, AC, *VD, *LD, *AC, Constant

Table of Contents

Other manuals for Siemens Simatic S7 Series

Related product manuals