EasyManua.ls Logo

Siemens SIMATIC S7-1200

Siemens SIMATIC S7-1200
1614 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...
Basic instructions
8.10 Shift and rotate
S7-1200 Programmable controller
332 System Manual, V4.2, 09/2016, A5E02486680-AK
8.10
Shift and rotate
8.10.1
SHR (Shift right) and SHL (Shift left) instructions
Table 8- 182 SHR and SHL instructions
LAD / FBD
SCL
Description
out := SHR(
in:=_variant_in_,
n:=_uint_in);
out := SHL(
in:=_variant_in_,
n:=_uint_in);
Use the shift instructions (SHL and SHR) to shift the bit pattern of
parameter IN. The result is assigned to parameter OUT. Parame-
ter N specifies the number of bit positions shifted:
SHR: Shift bit pattern right
SHL: Shift bit pattern left
1
For LAD and FBD: Click the "???" and select the data types from the drop-down menu.
Table 8- 183 Data types for the parameters
Parameter
Data type
Description
IN
Integers
Bit pattern to shift
N USInt, UDint Number of bit positions to shift
OUT
Integers
Bit pattern after shift operation
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
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).
ENO is always TRUE for the shift operations.
Table 8- 184 Example: SHL for Word data
Shift the bits of a Word to the left by inserting zeroes from the right (N = 1)
IN
1110 0010 1010 1101
OUT value before first shift:
1110 0010 1010 1101
After first shift left:
1100 0101 0101 1010
After second shift left:
1000 1010 1011 0100
After third shift left:
0001 0101 0110 1000

Table of Contents

Other manuals for Siemens SIMATIC S7-1200

Related product manuals