Siemens SIMATIC S7 System Manual page 358

Hide thumbs Also See for SIMATIC S7:
Table of Contents

Advertisement

Program instructions
7.14 Shift and rotate
Rotate instructions (only the byte size LAD box is illustrated, the others are similar)
LAD / FBD
STL
RLB OUT,
N
RRB OUT,
N
RLW OUT,
ROL_W
N
ROR_W
RRW OUT,
N
RLD OUT,
ROL_DW
N
ROR_DW
RRD OUT,
N
Non-fatal errors with ENO=0
0006H Indirect address
Input / output
Data type
IN
BYTE
WORD
DWORD
OUT
BYTE
WORD
DWORD
N
BYTE
358
Rotate type
Description
Rotate left 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
Rotate right byte
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.
Rotate left word
If the rotate count is not an integer multiple of 8 (for byte operations), 16 (for
Rotate right
word operations), or 32 (for double-word operations), the last bit value rotat-
word
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.
Rotate left dou-
Byte operations are unsigned. For word and double word operations, the
ble word
sign bit is rotated when you use signed data types.
Rotate 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
System Manual, V2.3, 07/2017, A5E03822230-AF
S7-200 SMART

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Simatic s7-200 smart

Table of Contents