Shift And Rotate; Shift Instructions - Siemens SIMATIC S7 System Manual

Hide thumbs Also See for SIMATIC S7:
Table of Contents

Advertisement

Table 7- 139 ENO status for the MUX and DEMUX instructions
ENO
Condition
1
No error
0
MUX: K is greater than the number of inputs -1
DEMUX: K is greater than the number of outputs -1
7.10

Shift and Rotate

7.10.1

Shift instructions

Table 7- 140 SHR and SHL instructions
LAD / FBD
SCL
out := SHR(
in:=_variant_in_,
n:=_uint_in);
out := SHL(
in:=_variant_in_,
n:=_uint_in);
For LAD and FBD: Click the "???" and select the data types from the drop-down menu.
1
Table 7- 141 Data types for the parameters
Parameter
Data type
IN
Byte, Word, DWord
N
UInt
OUT
Byte, Word, DWord
● For N=0, no shift occurs. The IN value is assigned to OUT.
● Zeros are shifted into the bit positions emptied by the shift operation.
● If the number of positions to shift (N) exceeds the number of bits in the target value (8 for
● ENO is always TRUE for the shift operations.
S7-1200 Programmable controller
System Manual, 11/2011, A5E02486680-05
Byte, 16 for Word, 32 for DWord), then all original bit values will be shifted out and
replaced with zeros (zero is assigned to OUT).
Result OUT
MUX: Selected IN value is copied to OUT
DEMUX: IN value is copied to selected OUT
No ELSE provided: OUT is unchanged,
ELSE provided, ELSE value assigned to OUT
No ELSE provided: outputs are unchanged,
ELSE provided, IN value copied to ELSE
Description
Use the shift instructions (SHL and SHR) to shift the bit pattern of
parameter IN. The result is assigned to parameter OUT.
Parameter N specifies the number of bit positions shifted:
SHR: Shift bit pattern right
SHL: Shift bit pattern left
Description
Bit pattern to shift
Number of bit positions to shift
Bit pattern after shift operation
100BBasic instructions
7.10 Shift and Rotate
231

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Simatic s7-1200

Table of Contents