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
System Manual, V4.2, 09/2016, A5E02486680-AK
333
8.10.2
ROR (Rotate right) and ROL (Rotate left) instructions
Table 8- 185 ROR and ROL instructions
LAD / FBD
SCL
Description
out := ROL(
in:=_variant_in_,
n:=_uint_in);
out := ROR(
in:=_variant_in_,
n:=_uint_in);
Use the rotate instructions (ROR and ROL) to rotate the bit pattern of
parameter IN. The result is assigned to parameter OUT. Parameter N
defines the number of bit positions rotated.
ROR: Rotate bit pattern right
ROL: Rotate bit pattern left
1
For LAD and FBD: Click the "???" and select the data types from the drop-down menu.
Table 8- 186 Data types for the parameters
Parameter
Data type
Description
IN
Integers
Bit pattern to rotate
N USInt, UDint Number of bit positions to rotate
OUT
Integers
Bit pattern after rotate operation
For N=0, no rotate occurs. The IN value is assigned to OUT.
Bit data rotated out one side of the target value is rotated into the other side of the target
value, so no original bit values are lost.
If the number of bit positions to rotate (N) exceeds the number of bits in the target value
(8 for Byte, 16 for Word, 32 for DWord), then the rotation is still performed.
ENO is always TRUE following execution of the rotate instructions.
Table 8- 187 Example: ROR for Word data
Rotate bits out the right -side into the left -side (N = 1)
IN
0100 0000 0000 0001
OUT value before first rotate:
0100 0000 0000 0001
After first rotate right:
1010 0000 0000 0000
After second rotate right:
0101 0000 0000 0000

Table of Contents

Other manuals for Siemens SIMATIC S7-1200

Related product manuals